Skip to content

Commit

Permalink
[ticket/9979] Support autoloading in unit tests
Browse files Browse the repository at this point in the history
PHPBB-9979
  • Loading branch information
igorw committed Jan 7, 2011
1 parent df9971d commit eb6283e
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 16 deletions.
4 changes: 4 additions & 0 deletions tests/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@
}

require_once $phpbb_root_path . 'includes/constants.php';
require_once $phpbb_root_path . 'includes/class_loader.' . $phpEx;

$class_loader = new phpbb_class_loader($phpbb_root_path, '.' . $phpEx);
$class_loader->register();

require_once 'test_framework/phpbb_test_case_helpers.php';
require_once 'test_framework/phpbb_test_case.php';
Expand Down
12 changes: 12 additions & 0 deletions tests/class_loader/class_loader_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,18 @@

class phpbb_class_loader_test extends PHPUnit_Framework_TestCase
{
public function setUp()
{
global $class_loader;
$class_loader->unregister();
}

public function tearDown()
{
global $class_loader;
$class_loader->register();
}

public function test_resolve_path()
{
$prefix = __DIR__ . '/';
Expand Down
3 changes: 0 additions & 3 deletions tests/request/deactivated_super_global.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@
*
*/

require_once __DIR__ . '/../../phpBB/includes/request/interface.php';
require_once __DIR__ . '/../../phpBB/includes/request/deactivated_super_global.php';

class phpbb_deactivated_super_global_test extends phpbb_test_case
{
/**
Expand Down
5 changes: 0 additions & 5 deletions tests/request/request.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,6 @@
*
*/

require_once __DIR__ . '/../../phpBB/includes/request/type_cast_helper_interface.php';
require_once __DIR__ . '/../../phpBB/includes/request/interface.php';
require_once __DIR__ . '/../../phpBB/includes/request/deactivated_super_global.php';
require_once __DIR__ . '/../../phpBB/includes/request/request.php';

class phpbb_request_test extends phpbb_test_case
{
private $type_cast_helper;
Expand Down
5 changes: 0 additions & 5 deletions tests/request/request_var.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,6 @@
*
*/

require_once __DIR__ . '/../../phpBB/includes/request/type_cast_helper_interface.php';
require_once __DIR__ . '/../../phpBB/includes/request/type_cast_helper.php';
require_once __DIR__ . '/../../phpBB/includes/request/deactivated_super_global.php';
require_once __DIR__ . '/../../phpBB/includes/request/interface.php';
require_once __DIR__ . '/../../phpBB/includes/request/request.php';
require_once __DIR__ . '/../../phpBB/includes/functions.php';

class phpbb_request_var_test extends phpbb_test_case
Expand Down
2 changes: 0 additions & 2 deletions tests/request/type_cast_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
*/

require_once __DIR__ . '/../../phpBB/includes/utf/utf_tools.php';
require_once __DIR__ . '/../../phpBB/includes/request/type_cast_helper_interface.php';
require_once __DIR__ . '/../../phpBB/includes/request/type_cast_helper.php';

class phpbb_type_cast_helper_test extends phpbb_test_case
{
Expand Down
1 change: 0 additions & 1 deletion tests/security/redirect.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
*/

require_once __DIR__ . '/base.php';

require_once __DIR__ . '/../../phpBB/includes/functions.php';
require_once __DIR__ . '/../../phpBB/includes/session.php';

Expand Down

0 comments on commit eb6283e

Please sign in to comment.