From a61ab1e5e4bbe786d3f500438bb0dd6ca395989e Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sat, 8 Jun 2013 17:02:31 +0200 Subject: [ticket/11550] Use new functionality from the test case helpers Instead of duplicating the extension copy code, it is now in the helpers. So we remove the code from existing tests. PHPBB3-11550 --- tests/functional/extension_controller_test.php | 41 ++++---------------------- 1 file changed, 6 insertions(+), 35 deletions(-) (limited to 'tests/functional/extension_controller_test.php') diff --git a/tests/functional/extension_controller_test.php b/tests/functional/extension_controller_test.php index a09035cb2b..c789ea160d 100644 --- a/tests/functional/extension_controller_test.php +++ b/tests/functional/extension_controller_test.php @@ -15,6 +15,8 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c { protected $phpbb_extension_manager; + static private $helper; + static protected $fixtures = array( 'foo/bar/config/routing.yml', 'foo/bar/config/services.yml', @@ -28,30 +30,10 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c */ static public function setUpBeforeClass() { - global $phpbb_root_path; parent::setUpBeforeClass(); - $directories = array( - $phpbb_root_path . 'ext/foo/bar/', - $phpbb_root_path . 'ext/foo/bar/config/', - $phpbb_root_path . 'ext/foo/bar/controller/', - $phpbb_root_path . 'ext/foo/bar/styles/prosilver/template', - ); - - foreach ($directories as $dir) - { - if (!is_dir($dir)) - { - mkdir($dir, 0777, true); - } - } - - foreach (self::$fixtures as $fixture) - { - copy( - "tests/functional/fixtures/ext/$fixture", - "{$phpbb_root_path}ext/$fixture"); - } + self::$helper = new phpbb_test_case_helpers(self); + self::$helper->copy_ext_fixtures(dirname(__FILE__) . '/fixtures/ext/', self::$fixtures); } /** @@ -60,20 +42,9 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c */ static public function tearDownAfterClass() { - global $phpbb_root_path; - - foreach (self::$fixtures as $fixture) - { - unlink("{$phpbb_root_path}ext/$fixture"); - } + parent::tearDownAfterClass(); - rmdir("{$phpbb_root_path}ext/foo/bar/config"); - rmdir("{$phpbb_root_path}ext/foo/bar/controller"); - rmdir("{$phpbb_root_path}ext/foo/bar/styles/prosilver/template"); - rmdir("{$phpbb_root_path}ext/foo/bar/styles/prosilver"); - rmdir("{$phpbb_root_path}ext/foo/bar/styles"); - rmdir("{$phpbb_root_path}ext/foo/bar"); - rmdir("{$phpbb_root_path}ext/foo"); + self::$helper->restore_original_ext_dir(); } public function setUp() -- cgit v1.2.1 From 7546c3a7a76a7293b3c1524097098f3f19c39666 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sat, 8 Jun 2013 17:14:20 +0200 Subject: [ticket/11550] Fixtures should only be directories not files PHPBB3-11550 --- tests/functional/extension_controller_test.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'tests/functional/extension_controller_test.php') diff --git a/tests/functional/extension_controller_test.php b/tests/functional/extension_controller_test.php index c789ea160d..ea5a51291d 100644 --- a/tests/functional/extension_controller_test.php +++ b/tests/functional/extension_controller_test.php @@ -18,10 +18,9 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c static private $helper; static protected $fixtures = array( - 'foo/bar/config/routing.yml', - 'foo/bar/config/services.yml', - 'foo/bar/controller/controller.php', - 'foo/bar/styles/prosilver/template/foo_bar_body.html', + 'foo/bar/config/', + 'foo/bar/controller/', + 'foo/bar/styles/prosilver/template/', ); /** -- cgit v1.2.1 From 68d15f0f14dfdc827e1169a73c194a9e30795605 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 11 Jun 2013 11:14:24 +0200 Subject: [ticket/11550] Move comments to correct function PHPBB3-11550 --- tests/functional/extension_controller_test.php | 8 -------- 1 file changed, 8 deletions(-) (limited to 'tests/functional/extension_controller_test.php') diff --git a/tests/functional/extension_controller_test.php b/tests/functional/extension_controller_test.php index ea5a51291d..9ddf1e3e5c 100644 --- a/tests/functional/extension_controller_test.php +++ b/tests/functional/extension_controller_test.php @@ -23,10 +23,6 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c 'foo/bar/styles/prosilver/template/', ); - /** - * This should only be called once before the tests are run. - * This is used to copy the fixtures to the phpBB install - */ static public function setUpBeforeClass() { parent::setUpBeforeClass(); @@ -35,10 +31,6 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c self::$helper->copy_ext_fixtures(dirname(__FILE__) . '/fixtures/ext/', self::$fixtures); } - /** - * This should only be called once after the tests are run. - * This is used to remove the fixtures from the phpBB install - */ static public function tearDownAfterClass() { parent::tearDownAfterClass(); -- cgit v1.2.1