From ddb1eaab6868cfac70b7b202468cab29315b794d Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Thu, 10 Jan 2013 12:49:13 -0600 Subject: [PATCH] [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 --- tests/dbal/migration/recall.php | 43 +++++++++++++++++++++++++++++++++ tests/dbal/migrator_test.php | 23 ++++++++++++++++++ 2 files changed, 66 insertions(+) create mode 100644 tests/dbal/migration/recall.php diff --git a/tests/dbal/migration/recall.php b/tests/dbal/migration/recall.php new file mode 100644 index 0000000000..18d8b4a6d2 --- /dev/null +++ b/tests/dbal/migration/recall.php @@ -0,0 +1,43 @@ +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); + } }