diff options
author | Marc Alexander <admin@m-a-styles.de> | 2013-07-04 00:14:48 +0200 |
---|---|---|
committer | Marc Alexander <admin@m-a-styles.de> | 2013-07-04 00:14:48 +0200 |
commit | 68f001aaaf761268975d38d7ddcbdf024bb26def (patch) | |
tree | afa75c51f61239f8ed842de8a8487a1b155ca69d /tests/test_framework/phpbb_test_case_helpers.php | |
parent | 6fc997924c2c9792c8151db67e3273202951de3e (diff) | |
parent | b3487b3167632f47d98eef25692924aa7ab25863 (diff) | |
download | forums-68f001aaaf761268975d38d7ddcbdf024bb26def.tar forums-68f001aaaf761268975d38d7ddcbdf024bb26def.tar.gz forums-68f001aaaf761268975d38d7ddcbdf024bb26def.tar.bz2 forums-68f001aaaf761268975d38d7ddcbdf024bb26def.tar.xz forums-68f001aaaf761268975d38d7ddcbdf024bb26def.zip |
Merge branch 'develop' of https://github.com/phpbb/phpbb3 into ticket/11600
Diffstat (limited to 'tests/test_framework/phpbb_test_case_helpers.php')
-rw-r--r-- | tests/test_framework/phpbb_test_case_helpers.php | 71 |
1 files changed, 50 insertions, 21 deletions
diff --git a/tests/test_framework/phpbb_test_case_helpers.php b/tests/test_framework/phpbb_test_case_helpers.php index 20ae384f21..50b2bf03ec 100644 --- a/tests/test_framework/phpbb_test_case_helpers.php +++ b/tests/test_framework/phpbb_test_case_helpers.php @@ -18,6 +18,56 @@ class phpbb_test_case_helpers $this->test_case = $test_case; } + /** + * 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; + + if (file_exists($phpbb_root_path . 'ext/')) + { + // First, move any extensions setup on the board to a temp directory + $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->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; + + // Remove all of the files we copied from test ext -> board ext + $this->empty_dir($phpbb_root_path . 'ext/'); + + // 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 from board ext -> temp_ext + $this->empty_dir($phpbb_root_path . 'store/temp_ext/'); + } + + if (file_exists($phpbb_root_path . 'store/temp_ext/')) + { + $this->empty_dir($phpbb_root_path . 'store/temp_ext/'); + } + } + public function setExpectedTriggerError($errno, $message = '') { $exceptionName = ''; @@ -203,27 +253,6 @@ class phpbb_test_case_helpers } /** - * Remove files/directories that are listed in an array - * Designed for use with $this->copy_dir() - * - * @param array $file_list - */ - public function remove_files($file_list) - { - foreach ($file_list as $file) - { - if (is_dir($file)) - { - rmdir($file); - } - else - { - unlink($file); - } - } - } - - /** * Empty directory (remove any subdirectories/files below) * * @param array $file_list |