aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorNathaniel Guse <nathaniel.guse@gmail.com>2014-05-01 22:16:02 -0500
committerNathaniel Guse <nathaniel.guse@gmail.com>2014-05-01 22:16:02 -0500
commit4f393ad0968e03085d19e8c7f71c755c9231918b (patch)
tree7dc288f0f136edc2ee69e897c5969c40aed1c864 /tests
parentf0036d2ac69f582c189bf26552d9710ae8f46c43 (diff)
parentea15b879f127f3d121d8e78ae01457b43b702e58 (diff)
downloadforums-4f393ad0968e03085d19e8c7f71c755c9231918b.tar
forums-4f393ad0968e03085d19e8c7f71c755c9231918b.tar.gz
forums-4f393ad0968e03085d19e8c7f71c755c9231918b.tar.bz2
forums-4f393ad0968e03085d19e8c7f71c755c9231918b.tar.xz
forums-4f393ad0968e03085d19e8c7f71c755c9231918b.zip
Merge remote-tracking branch 'remotes/Nicofuma/ticket/12432' into develop-ascraeus
# By Nicofuma # Via Nicofuma * remotes/Nicofuma/ticket/12432: [ticket/12432] Correcting the assertion [ticket/12432] Adding unit test [ticket/12432] Migrator should not revert custom functions
Diffstat (limited to 'tests')
-rw-r--r--tests/dbal/migration/revert.php8
-rw-r--r--tests/dbal/migrator_test.php6
2 files changed, 14 insertions, 0 deletions
diff --git a/tests/dbal/migration/revert.php b/tests/dbal/migration/revert.php
index c2520f4d8a..1c98710ffb 100644
--- a/tests/dbal/migration/revert.php
+++ b/tests/dbal/migration/revert.php
@@ -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;
+ }
}
diff --git a/tests/dbal/migrator_test.php b/tests/dbal/migrator_test.php
index c18c49b2a0..cc3e92071f 100644
--- a/tests/dbal/migrator_test.php
+++ b/tests/dbal/migrator_test.php
@@ -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()