diff options
| author | Andreas Fischer <bantu@phpbb.com> | 2013-06-11 14:35:54 +0200 |
|---|---|---|
| committer | Andreas Fischer <bantu@phpbb.com> | 2013-06-11 14:35:54 +0200 |
| commit | fba093de0578881b78128c5faa71a5194fe24b4e (patch) | |
| tree | 61ef00b7ba2994589c78001fe9dcb063bc06dca1 /tests/test_framework | |
| parent | e5d02f4b0caf8dbac7acdb44b096d28660977cd2 (diff) | |
| parent | 007cd6177630c3f70521be130a18f0139b58c184 (diff) | |
| download | forums-fba093de0578881b78128c5faa71a5194fe24b4e.tar forums-fba093de0578881b78128c5faa71a5194fe24b4e.tar.gz forums-fba093de0578881b78128c5faa71a5194fe24b4e.tar.bz2 forums-fba093de0578881b78128c5faa71a5194fe24b4e.tar.xz forums-fba093de0578881b78128c5faa71a5194fe24b4e.zip | |
Merge remote-tracking branch 'nickvergessen/ticket/11550' into develop
* nickvergessen/ticket/11550:
[ticket/11550] Specify a valid path so it's clearer that it must be a path
[ticket/11550] Move comments to correct function
[ticket/11550] We use a different fixture set for extension_acp_test.php
[ticket/11550] Fixtures should only be directories not files
[ticket/11550] Use new functionality from the test case helpers
[ticket/11550] Move functionality for copying/restoring to test case helpers
[ticket/11550] Fix copying the fixtures in extension_permission_lang_test.php
Diffstat (limited to 'tests/test_framework')
| -rw-r--r-- | tests/test_framework/phpbb_test_case_helpers.php | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/tests/test_framework/phpbb_test_case_helpers.php b/tests/test_framework/phpbb_test_case_helpers.php index 20ae384f21..1b08f2368f 100644 --- a/tests/test_framework/phpbb_test_case_helpers.php +++ b/tests/test_framework/phpbb_test_case_helpers.php @@ -18,6 +18,58 @@ class phpbb_test_case_helpers $this->test_case = $test_case; } + private $copied_files = array(); + + /** + * This should only be called once before the tests are run. + * This is used to copy the fixtures to the phpBB install + */ + public function copy_ext_fixtures($fixtures_dir, $fixtures) + { + global $phpbb_root_path; + + $this->copied_files = array(); + + if (file_exists($phpbb_root_path . 'ext/')) + { + // First, move any extensions setup on the board to a temp directory + $this->copied_files = $this->copy_dir($phpbb_root_path . 'ext/', $phpbb_root_path . 'store/temp_ext/'); + + // Then empty the ext/ directory on the board (for accurate test cases) + $this->empty_dir($phpbb_root_path . 'ext/'); + } + + // Copy our ext/ files from the test case to the board + foreach ($fixtures as $fixture) + { + $this->copied_files = array_merge($this->copied_files, $this->copy_dir($fixtures_dir . $fixture, $phpbb_root_path . 'ext/' . $fixture)); + } + } + + /** + * This should only be called once after the tests are run. + * This is used to remove the fixtures from the phpBB install + */ + public function restore_original_ext_dir() + { + global $phpbb_root_path; + + // Copy back the board installed extensions from the temp directory + if (file_exists($phpbb_root_path . 'store/temp_ext/')) + { + $this->copy_dir($phpbb_root_path . 'store/temp_ext/', $phpbb_root_path . 'ext/'); + } + + // Remove all of the files we copied around (from board ext -> temp_ext, from test ext -> board ext) + $this->remove_files($this->copied_files); + $this->copied_files = array(); + + if (file_exists($phpbb_root_path . 'store/temp_ext/')) + { + $this->empty_dir($phpbb_root_path . 'store/temp_ext/'); + } + } + public function setExpectedTriggerError($errno, $message = '') { $exceptionName = ''; |
