mirror of
https://github.com/phpbb/phpbb.git
synced 2025-05-05 23:25:30 +02:00
[ticket/11550] Move functionality for copying/restoring to test case helpers
PHPBB3-11550
This commit is contained in:
parent
3506408637
commit
c8ee6cb0c2
@ -18,6 +18,50 @@ class phpbb_test_case_helpers
|
||||
$this->test_case = $test_case;
|
||||
}
|
||||
|
||||
private $copied_files = array();
|
||||
|
||||
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 . 'ext/' . $fixture, $phpbb_root_path . 'ext/' . $fixture));
|
||||
}
|
||||
}
|
||||
|
||||
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 = '';
|
||||
|
Loading…
x
Reference in New Issue
Block a user