1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-10 10:44:20 +02:00

[feature/migrations] Reverse data functionality

If data step fails, attempt to roll back any previous calls from the
migration that failed.

Fix some failing tests

PHPBB3-9737
This commit is contained in:
Nathan Guse
2013-01-09 18:24:32 -06:00
parent 28cd253d19
commit 3d4c00619f
8 changed files with 240 additions and 15 deletions

View File

@@ -29,10 +29,10 @@ class phpbb_dbal_migrator_tool_module_test extends phpbb_database_test_case
$skip_add_log = true;
$db = $this->db = $this->new_dbal();
$this->cache = new phpbb_cache_service(new phpbb_cache_driver_null());
$this->cache = new phpbb_cache_service(new phpbb_cache_driver_null(), new phpbb_config(array()), $this->db, $phpbb_root_path, $phpEx);
$user = $this->user = new phpbb_user();
$this->tool = new phpbb_db_migration_tool_module($this->db, $this->cache, $this->user, $phpbb_root_path, $phpEx);
$this->tool = new phpbb_db_migration_tool_module($this->db, $this->cache, $this->user, $phpbb_root_path, $phpEx, 'phpbb_modules');
}
public function exists_data()
@@ -99,7 +99,7 @@ class phpbb_dbal_migrator_tool_module_test extends phpbb_database_test_case
try
{
$this->tool->add('acp', ACP_NEW_CAT, array(
$this->tool->add('acp', 'ACP_NEW_CAT', array(
'module_basename' => 'acp_new_module',
'module_langname' => 'ACP_NEW_MODULE',
'module_mode' => 'test',
@@ -125,4 +125,26 @@ class phpbb_dbal_migrator_tool_module_test extends phpbb_database_test_case
}
$this->assertEquals(false, $this->tool->exists('acp', 'ACP_CAT', 'ACP_MODULE'));
}
public function test_reverse()
{
try
{
$this->tool->add('acp', 0, 'ACP_NEW_CAT');
}
catch (Exception $e)
{
$this->fail($e);
}
try
{
$this->tool->reverse('add', 'acp', 0, 'ACP_NEW_CAT');
}
catch (Exception $e)
{
$this->fail($e);
}
$this->assertFalse($this->tool->exists('acp', 0, 'ACP_NEW_CAT'));
}
}