mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-08 04:18:52 +00:00
[ticket/12483] Move schema files into tmp/ and only copy them when needed
PHPBB3-12483
This commit is contained in:
parent
709296e54a
commit
5bae2911a2
1 changed files with 31 additions and 23 deletions
|
@ -54,11 +54,15 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test
|
||||||
|
|
||||||
static public function setUpBeforeClass()
|
static public function setUpBeforeClass()
|
||||||
{
|
{
|
||||||
$schema_md5 = md5(serialize(static::setup_extensions()));
|
$setup_extensions = static::setup_extensions();
|
||||||
|
self::$schema_file = '';
|
||||||
|
if (!empty($setup_extensions))
|
||||||
|
{
|
||||||
|
$schema_md5 = md5(serialize($setup_extensions));
|
||||||
|
|
||||||
self::$schema_file = __DIR__ . '/schemas/' . $schema_md5 . '.json';
|
self::$schema_file = __DIR__ . '/../tmp/' . $schema_md5 . '.json';
|
||||||
self::$phpbb_schema_copy = __DIR__ . '/schemas/schema_phpbb_copy.json';
|
self::$phpbb_schema_copy = __DIR__ . '/../tmp/schema_phpbb_copy.json';
|
||||||
self::$install_schema_file = __DIR__ . '/../../../../../install/schemas/schema.json';
|
self::$install_schema_file = __DIR__ . '/../../phpBB/install/schemas/schema.json';
|
||||||
|
|
||||||
if (!file_exists(self::$schema_file))
|
if (!file_exists(self::$schema_file))
|
||||||
{
|
{
|
||||||
|
@ -81,13 +85,17 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test
|
||||||
|
|
||||||
copy(self::$install_schema_file, self::$phpbb_schema_copy);
|
copy(self::$install_schema_file, self::$phpbb_schema_copy);
|
||||||
copy(self::$schema_file, self::$install_schema_file);
|
copy(self::$schema_file, self::$install_schema_file);
|
||||||
|
}
|
||||||
|
|
||||||
parent::setUpBeforeClass();
|
parent::setUpBeforeClass();
|
||||||
}
|
}
|
||||||
|
|
||||||
static public function tearDownAfterClass()
|
static public function tearDownAfterClass()
|
||||||
|
{
|
||||||
|
if (self::$schema_file !== '')
|
||||||
{
|
{
|
||||||
copy(self::$phpbb_schema_copy, self::$install_schema_file);
|
copy(self::$phpbb_schema_copy, self::$install_schema_file);
|
||||||
|
}
|
||||||
|
|
||||||
parent::tearDownAfterClass();
|
parent::tearDownAfterClass();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue