diff options
author | Joas Schilling <nickvergessen@gmx.de> | 2013-04-12 16:29:59 +0200 |
---|---|---|
committer | Joas Schilling <nickvergessen@gmx.de> | 2013-05-08 08:47:27 +0200 |
commit | 4c9c1d8c02142315d88bb7aaee2f64015c5033b7 (patch) | |
tree | 9bb7670e11b4547d8f23c796ff578fe8a49ba094 /tests | |
parent | 65c407044e77568ddcd80648830b8caf8fb3dd4a (diff) | |
download | forums-4c9c1d8c02142315d88bb7aaee2f64015c5033b7.tar forums-4c9c1d8c02142315d88bb7aaee2f64015c5033b7.tar.gz forums-4c9c1d8c02142315d88bb7aaee2f64015c5033b7.tar.bz2 forums-4c9c1d8c02142315d88bb7aaee2f64015c5033b7.tar.xz forums-4c9c1d8c02142315d88bb7aaee2f64015c5033b7.zip |
[ticket/11450] Use helpers to copy/remove files
PHPBB3-11450
Diffstat (limited to 'tests')
-rw-r--r-- | tests/functional/metadata_manager_test.php | 44 |
1 files changed, 21 insertions, 23 deletions
diff --git a/tests/functional/metadata_manager_test.php b/tests/functional/metadata_manager_test.php index deb8af7707..c639cad809 100644 --- a/tests/functional/metadata_manager_test.php +++ b/tests/functional/metadata_manager_test.php @@ -7,6 +7,8 @@ * */ +require_once dirname(__FILE__) . '/../../phpBB/includes/db/db_tools.php'; + /** * @group functional */ @@ -14,8 +16,10 @@ class phpbb_functional_metadata_manager_test extends phpbb_functional_test_case { protected $phpbb_extension_manager; + static private $helpers; + static protected $fixtures = array( - 'foo/bar/composer.json', + 'foo/bar/', ); /** @@ -27,23 +31,16 @@ class phpbb_functional_metadata_manager_test extends phpbb_functional_test_case global $phpbb_root_path; parent::setUpBeforeClass(); - $directories = array( - $phpbb_root_path . 'ext/foo/bar/', - ); + self::$helpers = new phpbb_test_case_helpers(self); - foreach ($directories as $dir) + if (!file_exists($phpbb_root_path . 'ext/foo/bar/')) { - if (!is_dir($dir)) - { - mkdir($dir, 0777, true); - } + self::$helpers->makedirs($phpbb_root_path . 'ext/foo/bar/'); } foreach (self::$fixtures as $fixture) { - copy( - "tests/functional/fixtures/ext/$fixture", - "{$phpbb_root_path}ext/$fixture"); + self::$helpers->copy_dir(dirname(__FILE__) . '/fixtures/ext/' . $fixture, $phpbb_root_path . 'ext/' . $fixture); } } @@ -57,11 +54,9 @@ class phpbb_functional_metadata_manager_test extends phpbb_functional_test_case foreach (self::$fixtures as $fixture) { - unlink("{$phpbb_root_path}ext/$fixture"); + self::$helpers->empty_dir($phpbb_root_path . 'ext/' . $fixture); } - - rmdir("{$phpbb_root_path}ext/foo/bar"); - rmdir("{$phpbb_root_path}ext/foo"); + self::$helpers->empty_dir($phpbb_root_path . 'ext/foo/'); } public function setUp() @@ -83,9 +78,9 @@ class phpbb_functional_metadata_manager_test extends phpbb_functional_test_case $crawler = $this->request('GET', 'adm/index.php?i=acp_extensions&mode=main&sid=' . $this->sid); $this->assert_response_success(); - $this->assertContains($this->lang('EXTENSIONS_EXPLAIN'), $this->client->getResponse()->getContent()); - $this->assertContains('phpBB 3.1 Extension Testing', $this->client->getResponse()->getContent()); - $this->assertContains('Details', $this->client->getResponse()->getContent()); + $this->assertContains($this->lang('EXTENSIONS_EXPLAIN'), $crawler->filter('#page-body')->text()); + $this->assertContains('phpBB 3.1 Extension Testing', $crawler->filter('#page-body')->text()); + $this->assertContains('Details', $crawler->filter('#page-body')->text()); } public function test_extensions_details() @@ -94,11 +89,14 @@ class phpbb_functional_metadata_manager_test extends phpbb_functional_test_case $this->assert_response_success(); // Test whether the details are displayed - $this->assertContains($this->lang('CLEAN_NAME'), $this->client->getResponse()->getContent()); - $this->assertContains('foo/bar', $this->client->getResponse()->getContent()); + $this->assertContains($this->lang('CLEAN_NAME'), $crawler->filter('#page-body')->text()); + $this->assertContains('foo/bar', $crawler->filter('#page-body')->text()); // Details should be html escaped - $this->assertContains($this->lang('PHP_VERSION'), $this->client->getResponse()->getContent()); + $this->assertContains($this->lang('PHP_VERSION'), $crawler->filter('#page-body')->text()); + // The Crawler parses the text, so we can not see whether it was escaped anymore + // To test this, we grab the content of the response directly + // $this->assertContains('>=5.3', $$crawler->filter('#page-body')->text()); $this->assertContains('>=5.3', $this->client->getResponse()->getContent()); } @@ -108,6 +106,6 @@ class phpbb_functional_metadata_manager_test extends phpbb_functional_test_case $this->assert_response_success(); // Error message because the files do not exist - $this->assertContains('The required file does not exist:', $this->client->getResponse()->getContent()); + $this->assertContains('The required file does not exist:', $crawler->filter('#page-body')->text()); } } |