mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-20 02:08:51 +00:00
Merge branch 'develop-ascraeus' into develop
# By Nicofuma # Via Nathaniel Guse (1) and Nicofuma (1) * develop-ascraeus: [ticket/12432] Correcting the assertion [ticket/12432] Adding unit test [ticket/12432] Migrator should not revert custom functions
This commit is contained in:
commit
bf32b31f8a
3 changed files with 25 additions and 4 deletions
|
@ -509,10 +509,17 @@ class migrator
|
|||
throw new \phpbb\db\migration\exception('MIGRATION_INVALID_DATA_CUSTOM_NOT_CALLABLE', $step);
|
||||
}
|
||||
|
||||
return array(
|
||||
$parameters[0],
|
||||
array($last_result),
|
||||
);
|
||||
if ($reverse)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return array(
|
||||
$parameters[0],
|
||||
array($last_result),
|
||||
);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -35,6 +35,14 @@ class phpbb_dbal_migration_revert extends \phpbb\db\migration\migration
|
|||
{
|
||||
return array(
|
||||
array('config.add', array('foobartest', 0)),
|
||||
array('custom', array(array(&$this, 'my_custom_function'))),
|
||||
);
|
||||
}
|
||||
|
||||
function my_custom_function()
|
||||
{
|
||||
global $migrator_test_revert_counter;
|
||||
|
||||
$migrator_test_revert_counter += 1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -174,10 +174,14 @@ class phpbb_dbal_migrator_test extends phpbb_database_test_case
|
|||
|
||||
public function test_revert()
|
||||
{
|
||||
global $migrator_test_revert_counter;
|
||||
|
||||
// Make sure there are no other migrations in the db, this could cause issues
|
||||
$this->db->sql_query("DELETE FROM phpbb_migrations");
|
||||
$this->migrator->load_migration_state();
|
||||
|
||||
$migrator_test_revert_counter = 0;
|
||||
|
||||
$this->migrator->set_migrations(array('phpbb_dbal_migration_revert', 'phpbb_dbal_migration_revert_with_dependency'));
|
||||
|
||||
$this->assertFalse($this->migrator->migration_state('phpbb_dbal_migration_revert'));
|
||||
|
@ -219,6 +223,8 @@ class phpbb_dbal_migrator_test extends phpbb_database_test_case
|
|||
{
|
||||
$this->fail('Revert did not remove test_column.');
|
||||
}
|
||||
|
||||
$this->assertEquals(1, $migrator_test_revert_counter, 'Revert did call custom function again');
|
||||
}
|
||||
|
||||
public function test_fail()
|
||||
|
|
Loading…
Add table
Reference in a new issue