mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 14:18:52 +00:00
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
This commit is contained in:
commit
fba093de05
6 changed files with 87 additions and 193 deletions
|
@ -12,34 +12,25 @@
|
|||
*/
|
||||
class phpbb_functional_extension_acp_test extends phpbb_functional_test_case
|
||||
{
|
||||
static private $copied_files = array();
|
||||
static private $helper;
|
||||
|
||||
/**
|
||||
* This should only be called once before the tests are run.
|
||||
* This is used to copy the extensions to the phpBB install
|
||||
*/
|
||||
static protected $fixtures = array(
|
||||
'./',
|
||||
);
|
||||
|
||||
static public function setUpBeforeClass()
|
||||
{
|
||||
global $phpbb_root_path;
|
||||
|
||||
parent::setUpBeforeClass();
|
||||
|
||||
self::$helper = new phpbb_test_case_helpers(self);
|
||||
self::$helper->copy_ext_fixtures(dirname(__FILE__) . '/../extension/ext/', self::$fixtures);
|
||||
}
|
||||
|
||||
self::$copied_files = array();
|
||||
static public function tearDownAfterClass()
|
||||
{
|
||||
parent::tearDownAfterClass();
|
||||
|
||||
if (file_exists($phpbb_root_path . 'ext/'))
|
||||
{
|
||||
// First, move any extensions setup on the board to a temp directory
|
||||
self::$copied_files = self::$helper->copy_dir($phpbb_root_path . 'ext/', $phpbb_root_path . 'store/temp_ext/');
|
||||
|
||||
// Then empty the ext/ directory on the board (for accurate test cases)
|
||||
self::$helper->empty_dir($phpbb_root_path . 'ext/');
|
||||
}
|
||||
|
||||
// Copy our ext/ files from the test case to the board
|
||||
self::$copied_files = array_merge(self::$copied_files, self::$helper->copy_dir(dirname(__FILE__) . '/../extension/ext/', $phpbb_root_path . 'ext/'));
|
||||
self::$helper->restore_original_ext_dir();
|
||||
}
|
||||
|
||||
public function setUp()
|
||||
|
@ -84,29 +75,6 @@ class phpbb_functional_extension_acp_test extends phpbb_functional_test_case
|
|||
$this->add_lang('acp/extensions');
|
||||
}
|
||||
|
||||
/**
|
||||
* This should only be called once after the tests are run.
|
||||
* This is used to remove the files copied to the phpBB install
|
||||
*/
|
||||
static public function tearDownAfterClass()
|
||||
{
|
||||
global $phpbb_root_path;
|
||||
|
||||
if (file_exists($phpbb_root_path . 'store/temp_ext/'))
|
||||
{
|
||||
// Copy back the board installed extensions from the temp directory
|
||||
self::$helper->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)
|
||||
self::$helper->remove_files(self::$copied_files);
|
||||
|
||||
if (file_exists($phpbb_root_path . 'store/temp_ext/'))
|
||||
{
|
||||
self::$helper->empty_dir($phpbb_root_path . 'store/temp_ext/');
|
||||
}
|
||||
}
|
||||
|
||||
public function test_list()
|
||||
{
|
||||
$crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&sid=' . $this->sid);
|
||||
|
|
|
@ -15,65 +15,27 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c
|
|||
{
|
||||
protected $phpbb_extension_manager;
|
||||
|
||||
static private $helper;
|
||||
|
||||
static protected $fixtures = array(
|
||||
'foo/bar/config/routing.yml',
|
||||
'foo/bar/config/services.yml',
|
||||
'foo/bar/controller/controller.php',
|
||||
'foo/bar/styles/prosilver/template/foo_bar_body.html',
|
||||
'foo/bar/config/',
|
||||
'foo/bar/controller/',
|
||||
'foo/bar/styles/prosilver/template/',
|
||||
);
|
||||
|
||||
/**
|
||||
* This should only be called once before the tests are run.
|
||||
* This is used to copy the fixtures to the phpBB install
|
||||
*/
|
||||
static public function setUpBeforeClass()
|
||||
{
|
||||
global $phpbb_root_path;
|
||||
parent::setUpBeforeClass();
|
||||
|
||||
$directories = array(
|
||||
$phpbb_root_path . 'ext/foo/bar/',
|
||||
$phpbb_root_path . 'ext/foo/bar/config/',
|
||||
$phpbb_root_path . 'ext/foo/bar/controller/',
|
||||
$phpbb_root_path . 'ext/foo/bar/styles/prosilver/template',
|
||||
);
|
||||
|
||||
foreach ($directories as $dir)
|
||||
{
|
||||
if (!is_dir($dir))
|
||||
{
|
||||
mkdir($dir, 0777, true);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (self::$fixtures as $fixture)
|
||||
{
|
||||
copy(
|
||||
"tests/functional/fixtures/ext/$fixture",
|
||||
"{$phpbb_root_path}ext/$fixture");
|
||||
}
|
||||
self::$helper = new phpbb_test_case_helpers(self);
|
||||
self::$helper->copy_ext_fixtures(dirname(__FILE__) . '/fixtures/ext/', self::$fixtures);
|
||||
}
|
||||
|
||||
/**
|
||||
* This should only be called once after the tests are run.
|
||||
* This is used to remove the fixtures from the phpBB install
|
||||
*/
|
||||
static public function tearDownAfterClass()
|
||||
{
|
||||
global $phpbb_root_path;
|
||||
parent::tearDownAfterClass();
|
||||
|
||||
foreach (self::$fixtures as $fixture)
|
||||
{
|
||||
unlink("{$phpbb_root_path}ext/$fixture");
|
||||
}
|
||||
|
||||
rmdir("{$phpbb_root_path}ext/foo/bar/config");
|
||||
rmdir("{$phpbb_root_path}ext/foo/bar/controller");
|
||||
rmdir("{$phpbb_root_path}ext/foo/bar/styles/prosilver/template");
|
||||
rmdir("{$phpbb_root_path}ext/foo/bar/styles/prosilver");
|
||||
rmdir("{$phpbb_root_path}ext/foo/bar/styles");
|
||||
rmdir("{$phpbb_root_path}ext/foo/bar");
|
||||
rmdir("{$phpbb_root_path}ext/foo");
|
||||
self::$helper->restore_original_ext_dir();
|
||||
}
|
||||
|
||||
public function setUp()
|
||||
|
|
|
@ -16,56 +16,26 @@ require_once dirname(__FILE__) . '/../../phpBB/includes/acp/acp_modules.php';
|
|||
class phpbb_functional_extension_module_test extends phpbb_functional_test_case
|
||||
{
|
||||
protected $phpbb_extension_manager;
|
||||
static private $copied_files = array();
|
||||
|
||||
static private $helper;
|
||||
|
||||
/**
|
||||
* This should only be called once before the tests are run.
|
||||
* This is used to copy the fixtures to the phpBB install
|
||||
*/
|
||||
static protected $fixtures = array(
|
||||
'./',
|
||||
);
|
||||
|
||||
static public function setUpBeforeClass()
|
||||
{
|
||||
global $phpbb_root_path;
|
||||
parent::setUpBeforeClass();
|
||||
|
||||
self::$helper = new phpbb_test_case_helpers(self);
|
||||
|
||||
self::$copied_files = array();
|
||||
|
||||
if (file_exists($phpbb_root_path . 'ext/'))
|
||||
{
|
||||
// First, move any extensions setup on the board to a temp directory
|
||||
self::$copied_files = self::$helper->copy_dir($phpbb_root_path . 'ext/', $phpbb_root_path . 'store/temp_ext/');
|
||||
|
||||
// Then empty the ext/ directory on the board (for accurate test cases)
|
||||
self::$helper->empty_dir($phpbb_root_path . 'ext/');
|
||||
}
|
||||
|
||||
// Copy our ext/ files from the test case to the board
|
||||
self::$copied_files = array_merge(self::$copied_files, self::$helper->copy_dir(dirname(__FILE__) . '/fixtures/ext/', $phpbb_root_path . 'ext/'));
|
||||
self::$helper->copy_ext_fixtures(dirname(__FILE__) . '/fixtures/ext/', self::$fixtures);
|
||||
}
|
||||
|
||||
/**
|
||||
* This should only be called once after the tests are run.
|
||||
* This is used to remove the fixtures from the phpBB install
|
||||
*/
|
||||
static public function tearDownAfterClass()
|
||||
{
|
||||
global $phpbb_root_path;
|
||||
parent::tearDownAfterClass();
|
||||
|
||||
if (file_exists($phpbb_root_path . 'store/temp_ext/'))
|
||||
{
|
||||
// Copy back the board installed extensions from the temp directory
|
||||
self::$helper->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)
|
||||
self::$helper->remove_files(self::$copied_files);
|
||||
|
||||
if (file_exists($phpbb_root_path . 'store/temp_ext/'))
|
||||
{
|
||||
self::$helper->empty_dir($phpbb_root_path . 'store/temp_ext/');
|
||||
}
|
||||
self::$helper->restore_original_ext_dir();
|
||||
}
|
||||
|
||||
public function setUp()
|
||||
|
|
|
@ -16,59 +16,23 @@ class phpbb_functional_extension_permission_lang_test extends phpbb_functional_t
|
|||
|
||||
static private $helper;
|
||||
|
||||
static private $copied_files = array();
|
||||
|
||||
static protected $fixtures = array(
|
||||
'foo/bar/language/en/',
|
||||
);
|
||||
|
||||
/**
|
||||
* This should only be called once before the tests are run.
|
||||
* This is used to copy the fixtures to the phpBB install
|
||||
*/
|
||||
static public function setUpBeforeClass()
|
||||
{
|
||||
global $phpbb_root_path;
|
||||
parent::setUpBeforeClass();
|
||||
|
||||
self::$helper = new phpbb_test_case_helpers(self);
|
||||
|
||||
self::$copied_files = array();
|
||||
|
||||
if (file_exists($phpbb_root_path . 'ext/'))
|
||||
{
|
||||
// First, move any extensions setup on the board to a temp directory
|
||||
self::$copied_files = self::$helper->copy_dir($phpbb_root_path . 'ext/', $phpbb_root_path . 'store/temp_ext/');
|
||||
|
||||
// Then empty the ext/ directory on the board (for accurate test cases)
|
||||
self::$helper->empty_dir($phpbb_root_path . 'ext/');
|
||||
}
|
||||
|
||||
// Copy our ext/ files from the test case to the board
|
||||
self::$copied_files = array_merge(self::$copied_files, self::$helper->copy_dir(dirname(__FILE__) . '/fixtures/ext/' . $fixture, $phpbb_root_path . 'ext/' . $fixture));
|
||||
self::$helper->copy_ext_fixtures(dirname(__FILE__) . '/fixtures/ext/', self::$fixtures);
|
||||
}
|
||||
|
||||
/**
|
||||
* This should only be called once after the tests are run.
|
||||
* This is used to remove the fixtures from the phpBB install
|
||||
*/
|
||||
static public function tearDownAfterClass()
|
||||
{
|
||||
global $phpbb_root_path;
|
||||
parent::tearDownAfterClass();
|
||||
|
||||
if (file_exists($phpbb_root_path . 'store/temp_ext/'))
|
||||
{
|
||||
// Copy back the board installed extensions from the temp directory
|
||||
self::$helper->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)
|
||||
self::$helper->remove_files(self::$copied_files);
|
||||
|
||||
if (file_exists($phpbb_root_path . 'store/temp_ext/'))
|
||||
{
|
||||
self::$helper->empty_dir($phpbb_root_path . 'store/temp_ext/');
|
||||
}
|
||||
self::$helper->restore_original_ext_dir();
|
||||
}
|
||||
|
||||
public function setUp()
|
||||
|
|
|
@ -16,47 +16,25 @@ class phpbb_functional_metadata_manager_test extends phpbb_functional_test_case
|
|||
{
|
||||
protected $phpbb_extension_manager;
|
||||
|
||||
static private $helpers;
|
||||
static private $helper;
|
||||
|
||||
static protected $fixtures = array(
|
||||
'foo/bar/',
|
||||
);
|
||||
|
||||
/**
|
||||
* This should only be called once before the tests are run.
|
||||
* This is used to copy the fixtures to the phpBB install
|
||||
*/
|
||||
static public function setUpBeforeClass()
|
||||
{
|
||||
global $phpbb_root_path;
|
||||
parent::setUpBeforeClass();
|
||||
|
||||
self::$helpers = new phpbb_test_case_helpers(self);
|
||||
|
||||
if (!file_exists($phpbb_root_path . 'ext/foo/bar/'))
|
||||
{
|
||||
self::$helpers->makedirs($phpbb_root_path . 'ext/foo/bar/');
|
||||
}
|
||||
|
||||
foreach (self::$fixtures as $fixture)
|
||||
{
|
||||
self::$helpers->copy_dir(dirname(__FILE__) . '/fixtures/ext/' . $fixture, $phpbb_root_path . 'ext/' . $fixture);
|
||||
}
|
||||
self::$helper = new phpbb_test_case_helpers(self);
|
||||
self::$helper->copy_ext_fixtures(dirname(__FILE__) . '/fixtures/ext/', self::$fixtures);
|
||||
}
|
||||
|
||||
/**
|
||||
* This should only be called once after the tests are run.
|
||||
* This is used to remove the fixtures from the phpBB install
|
||||
*/
|
||||
static public function tearDownAfterClass()
|
||||
{
|
||||
global $phpbb_root_path;
|
||||
parent::tearDownAfterClass();
|
||||
|
||||
foreach (self::$fixtures as $fixture)
|
||||
{
|
||||
self::$helpers->empty_dir($phpbb_root_path . 'ext/' . $fixture);
|
||||
}
|
||||
self::$helpers->empty_dir($phpbb_root_path . 'ext/foo/');
|
||||
self::$helper->restore_original_ext_dir();
|
||||
}
|
||||
|
||||
public function setUp()
|
||||
|
|
|
@ -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 = '';
|
||||
|
|
Loading…
Add table
Reference in a new issue