Skip to content

Commit

Permalink
Merge remote-tracking branch 'github-bantu/ticket/10973' into develop
Browse files Browse the repository at this point in the history
* github-bantu/ticket/10973:
  [ticket/10973] Drop all require_once for mocks. Use autoloading.
  [ticket/10973] Add autoloader for autoloading phpbb_mock_ in tests.

Conflicts:
	tests/bbcode/url_bbcode_test.php
	tests/text_processing/censor_text_test.php
  • Loading branch information
naderman committed Jul 8, 2012
2 parents 527f02b + d3bbde6 commit 9f0259c
Show file tree
Hide file tree
Showing 20 changed files with 4 additions and 31 deletions.
2 changes: 0 additions & 2 deletions tests/bbcode/url_bbcode_test.php
Expand Up @@ -11,8 +11,6 @@
require_once dirname(__FILE__) . '/../../phpBB/includes/functions_content.php';
require_once dirname(__FILE__) . '/../../phpBB/includes/bbcode.php';
require_once dirname(__FILE__) . '/../../phpBB/includes/message_parser.php';
require_once dirname(__FILE__) . '/../mock/user.php';
require_once dirname(__FILE__) . '/../mock/request.php';

class phpbb_url_bbcode_test extends phpbb_test_case
{
Expand Down
2 changes: 2 additions & 0 deletions tests/bootstrap.php
Expand Up @@ -16,6 +16,8 @@
require_once $phpbb_root_path . 'includes/constants.php';
require_once $phpbb_root_path . 'includes/class_loader.' . $phpEx;

$phpbb_class_loader_mock = new phpbb_class_loader('phpbb_mock_', $phpbb_root_path . '../tests/mock/', ".php");
$phpbb_class_loader_mock->register();
$phpbb_class_loader_ext = new phpbb_class_loader('phpbb_ext_', $phpbb_root_path . 'ext/', ".php");
$phpbb_class_loader_ext->register();
$phpbb_class_loader = new phpbb_class_loader('phpbb_', $phpbb_root_path . 'includes/', ".php");
Expand Down
2 changes: 0 additions & 2 deletions tests/class_loader/class_loader_test.php
Expand Up @@ -7,8 +7,6 @@
*
*/

require_once dirname(__FILE__) . '/../mock/cache.php';

class phpbb_class_loader_test extends PHPUnit_Framework_TestCase
{
public function setUp()
Expand Down
2 changes: 0 additions & 2 deletions tests/config/db_test.php
Expand Up @@ -7,8 +7,6 @@
*
*/

require_once dirname(__FILE__) . '/../mock/cache.php';

class phpbb_config_db_test extends phpbb_database_test_case
{
private $cache;
Expand Down
1 change: 0 additions & 1 deletion tests/cron/manager_test.php
Expand Up @@ -7,7 +7,6 @@
*
*/

require_once dirname(__FILE__) . '/../mock/extension_manager.php';
require_once dirname(__FILE__) . '/includes/cron/task/core/dummy_task.php';
require_once dirname(__FILE__) . '/includes/cron/task/core/second_dummy_task.php';
require_once dirname(__FILE__) . '/ext/testext/cron/dummy_task.php';
Expand Down
2 changes: 0 additions & 2 deletions tests/cron/task_provider_test.php
Expand Up @@ -7,8 +7,6 @@
*
*/

require_once dirname(__FILE__) . '/../mock/extension_manager.php';

class phpbb_cron_task_provider_test extends PHPUnit_Framework_TestCase
{
public function setUp()
Expand Down
1 change: 0 additions & 1 deletion tests/download/http_byte_range_test.php
Expand Up @@ -8,7 +8,6 @@
*/

require_once dirname(__FILE__) . '/../../phpBB/includes/functions_download.php';
require_once dirname(__FILE__) . '/../mock/request.php';

class phpbb_download_http_byte_range_test extends phpbb_test_case
{
Expand Down
3 changes: 0 additions & 3 deletions tests/extension/finder_test.php
Expand Up @@ -7,9 +7,6 @@
*
*/

require_once dirname(__FILE__) . '/../mock/cache.php';
require_once dirname(__FILE__) . '/../mock/extension_manager.php';

class phpbb_extension_finder_test extends phpbb_test_case
{
protected $extension_manager;
Expand Down
1 change: 0 additions & 1 deletion tests/extension/manager_test.php
Expand Up @@ -7,7 +7,6 @@
*
*/

require_once dirname(__FILE__) . '/../mock/cache.php';
require_once dirname(__FILE__) . '/ext/bar/ext.php';
require_once dirname(__FILE__) . '/ext/foo/ext.php';
require_once dirname(__FILE__) . '/ext/vendor/moo/ext.php';
Expand Down
1 change: 0 additions & 1 deletion tests/functions_acp/build_cfg_template_test.php
Expand Up @@ -7,7 +7,6 @@
*
*/

require_once dirname(__FILE__) . '/../mock/lang.php';
require_once dirname(__FILE__) . '/../../phpBB/includes/functions_acp.php';

class phpbb_functions_acp_build_cfg_template_test extends phpbb_test_case
Expand Down
1 change: 0 additions & 1 deletion tests/functions_acp/build_select_test.php
Expand Up @@ -7,7 +7,6 @@
*
*/

require_once dirname(__FILE__) . '/../mock/lang.php';
require_once dirname(__FILE__) . '/../../phpBB/includes/functions_acp.php';

class phpbb_functions_acp_built_select_test extends phpbb_test_case
Expand Down
1 change: 0 additions & 1 deletion tests/functions_acp/h_radio_test.php
Expand Up @@ -7,7 +7,6 @@
*
*/

require_once dirname(__FILE__) . '/../mock/lang.php';
require_once dirname(__FILE__) . '/../../phpBB/includes/functions_acp.php';

class phpbb_functions_acp_h_radio_test extends phpbb_test_case
Expand Down
1 change: 0 additions & 1 deletion tests/functions_acp/validate_config_vars_test.php
Expand Up @@ -7,7 +7,6 @@
*
*/

require_once dirname(__FILE__) . '/../mock/lang.php';
require_once dirname(__FILE__) . '/../../phpBB/includes/functions_acp.php';

class phpbb_functions_acp_validate_config_vars_test extends phpbb_test_case
Expand Down
1 change: 0 additions & 1 deletion tests/functions_acp/validate_range_test.php
Expand Up @@ -7,7 +7,6 @@
*
*/

require_once dirname(__FILE__) . '/../mock/lang.php';
require_once dirname(__FILE__) . '/../../phpBB/includes/utf/utf_tools.php';
require_once dirname(__FILE__) . '/../../phpBB/includes/functions_acp.php';

Expand Down
2 changes: 0 additions & 2 deletions tests/security/base.php
Expand Up @@ -7,8 +7,6 @@
*
*/

require_once dirname(__FILE__) . '/../mock/request.php';

abstract class phpbb_security_test_base extends phpbb_test_case
{
/**
Expand Down
1 change: 0 additions & 1 deletion tests/session/continue_test.php
Expand Up @@ -7,7 +7,6 @@
*
*/

require_once dirname(__FILE__) . '/../mock/cache.php';
require_once dirname(__FILE__) . '/testable_factory.php';

class phpbb_session_continue_test extends phpbb_database_test_case
Expand Down
1 change: 0 additions & 1 deletion tests/session/init_test.php
Expand Up @@ -7,7 +7,6 @@
*
*/

require_once dirname(__FILE__) . '/../mock/cache.php';
require_once dirname(__FILE__) . '/testable_factory.php';

class phpbb_session_init_test extends phpbb_database_test_case
Expand Down
3 changes: 0 additions & 3 deletions tests/session/testable_factory.php
Expand Up @@ -7,9 +7,6 @@
*
*/

require_once dirname(__FILE__) . '/../mock/request.php';
require_once dirname(__FILE__) . '/../mock/session_testable.php';

/**
* This class exists to setup an instance of phpbb's session class for testing.
*
Expand Down
1 change: 0 additions & 1 deletion tests/template/template_test_case.php
Expand Up @@ -8,7 +8,6 @@
*/

require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php';
require_once dirname(__FILE__) . '/../mock/extension_manager.php';

class phpbb_template_template_test_case extends phpbb_test_case
{
Expand Down
6 changes: 2 additions & 4 deletions tests/text_processing/censor_text_test.php
Expand Up @@ -9,8 +9,6 @@

require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php';
require_once dirname(__FILE__) . '/../../phpBB/includes/functions_content.php';
require_once dirname(__FILE__) . '/../mock/user.php';
require_once dirname(__FILE__) . '/../mock/cache.php';

class phpbb_text_processing_censor_text_test extends phpbb_test_case
{
Expand All @@ -19,7 +17,7 @@ public function censor_text_data()
global $cache, $user;
$cache = new phpbb_mock_cache;
$user = new phpbb_mock_user;

$user->optionset('viewcensors', false);

return array(
Expand Down Expand Up @@ -61,7 +59,7 @@ public function censor_text_data()
array('badword1 badword2 badword3 badword4', 'replacement1 replacement2 replacement3 replacement4'),
array('badword1 badword2 badword3 badword4d', 'replacement1 replacement2 replacement3 badword4d'),
array('abadword1 badword2 badword3 badword4', 'replacement1 replacement2 replacement3 replacement4'),

array("new\nline\ntest", "new\nline\ntest"),
array("tab\ttest\t", "tab\ttest\t"),
array('öäü', 'öäü'),
Expand Down

0 comments on commit 9f0259c

Please sign in to comment.