diff options
| author | Dhruv <dhruv.goel92@gmail.com> | 2013-06-13 22:05:01 +0530 |
|---|---|---|
| committer | Dhruv <dhruv.goel92@gmail.com> | 2013-06-13 22:05:01 +0530 |
| commit | 773bcc1c9bdf68925587c2ca6634938f29210365 (patch) | |
| tree | eb2952fd9c75bf3902ff521adf475b2c01276ab4 /tests/test_framework/phpbb_test_case_helpers.php | |
| parent | e8b535bf9beda58ea8f75071ed31934534849cb1 (diff) | |
| parent | b4183eda0caae2dfbe1425db27f3618c98db8504 (diff) | |
| download | forums-773bcc1c9bdf68925587c2ca6634938f29210365.tar forums-773bcc1c9bdf68925587c2ca6634938f29210365.tar.gz forums-773bcc1c9bdf68925587c2ca6634938f29210365.tar.bz2 forums-773bcc1c9bdf68925587c2ca6634938f29210365.tar.xz forums-773bcc1c9bdf68925587c2ca6634938f29210365.zip | |
Merge branch 'develop' into ticket/10820-develop
# By Marc Alexander (10) and Joas Schilling (2)
# Via Andreas Fischer (3) and Joas Schilling (1)
* develop:
[ticket/11605] Remove unused copied_files property
[ticket/11605] Use empty_dir to better delete files and dirs of extensions
[ticket/11579] Add method for validating emails for valid MX and mark as slow
[ticket/11579] Do not extend validate_data_helper
[ticket/11579] Add missing commas to validate_username_test
[ticket/11579] Rework calls to validate_data_helper
[ticket/11579] Move simple tests into seperate files
[ticket/11579] Use test case helper class and use assert prefix for method
[ticket/11579] Move tests into seperate files depending on needed fixture
[ticket/11579] Remove unnecessary globals from validate_password()
[ticket/11579] Add remaining unit tests for validate_data functions
[ticket/11579] Add basic set of unit tests for validate_data()
Diffstat (limited to 'tests/test_framework/phpbb_test_case_helpers.php')
| -rw-r--r-- | tests/test_framework/phpbb_test_case_helpers.php | 39 |
1 files changed, 8 insertions, 31 deletions
diff --git a/tests/test_framework/phpbb_test_case_helpers.php b/tests/test_framework/phpbb_test_case_helpers.php index 1b08f2368f..50b2bf03ec 100644 --- a/tests/test_framework/phpbb_test_case_helpers.php +++ b/tests/test_framework/phpbb_test_case_helpers.php @@ -18,8 +18,6 @@ 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 @@ -28,12 +26,10 @@ class phpbb_test_case_helpers { 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/'); + $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/'); @@ -42,7 +38,7 @@ class phpbb_test_case_helpers // 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->copy_dir($fixtures_dir . $fixture, $phpbb_root_path . 'ext/' . $fixture); } } @@ -54,15 +50,17 @@ class phpbb_test_case_helpers { 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 around (from board ext -> temp_ext, from test ext -> board ext) - $this->remove_files($this->copied_files); - $this->copied_files = array(); + // 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/')) { @@ -255,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 |
