diff options
| author | Nathan Guse <nathaniel.guse@gmail.com> | 2013-01-10 12:49:13 -0600 |
|---|---|---|
| committer | Nathan Guse <nathaniel.guse@gmail.com> | 2013-01-10 12:49:13 -0600 |
| commit | ddb1eaab6868cfac70b7b202468cab29315b794d (patch) | |
| tree | eeac822752a856b0457b189bfcc09699ffdbef4d /tests/dbal/migrator_test.php | |
| parent | 44c10f661ee548ae08fe81ba76f47f1c8134b96f (diff) | |
| download | forums-ddb1eaab6868cfac70b7b202468cab29315b794d.tar forums-ddb1eaab6868cfac70b7b202468cab29315b794d.tar.gz forums-ddb1eaab6868cfac70b7b202468cab29315b794d.tar.bz2 forums-ddb1eaab6868cfac70b7b202468cab29315b794d.tar.xz forums-ddb1eaab6868cfac70b7b202468cab29315b794d.zip | |
[feature/migrations] Test for calling a step multiple times
This is used when a long-running process is needed during an update. For
example, iterating over all posts and applying some transformation. This
allows the process to be broken apart into multiple shorter steps to prevent
hitting the time limit.
PHPBB3-9737
Diffstat (limited to 'tests/dbal/migrator_test.php')
| -rw-r--r-- | tests/dbal/migrator_test.php | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/dbal/migrator_test.php b/tests/dbal/migrator_test.php index dd592d7b05..9c40eec15a 100644 --- a/tests/dbal/migrator_test.php +++ b/tests/dbal/migrator_test.php @@ -15,6 +15,7 @@ require_once dirname(__FILE__) . '/../../phpBB/includes/db/db_tools.php'; require_once dirname(__FILE__) . '/migration/dummy.php'; require_once dirname(__FILE__) . '/migration/unfulfillable.php'; require_once dirname(__FILE__) . '/migration/if.php'; +require_once dirname(__FILE__) . '/migration/recall.php'; class phpbb_dbal_migrator_test extends phpbb_database_test_case { @@ -127,4 +128,26 @@ class phpbb_dbal_migrator_test extends phpbb_database_test_case $this->fail('False test failed'); } } + + public function test_recall() + { + $this->migrator->set_migrations(array('phpbb_dbal_migration_recall')); + + global $migrator_test_call_input; + + // Run the schema first + $this->migrator->update(); + + $i = 0; + while (!$this->migrator->finished()) + { + $this->migrator->update(); + + $this->assertSame($i, $migrator_test_call_input); + + $i++; + } + + $this->assertSame(10, $migrator_test_call_input); + } } |
