aboutsummaryrefslogtreecommitdiffstats
path: root/tests/dbal/migration
diff options
context:
space:
mode:
authorNathan Guse <nathaniel.guse@gmail.com>2013-01-10 12:49:13 -0600
committerNathan Guse <nathaniel.guse@gmail.com>2013-01-10 12:49:13 -0600
commitddb1eaab6868cfac70b7b202468cab29315b794d (patch)
treeeeac822752a856b0457b189bfcc09699ffdbef4d /tests/dbal/migration
parent44c10f661ee548ae08fe81ba76f47f1c8134b96f (diff)
downloadforums-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/migration')
-rw-r--r--tests/dbal/migration/recall.php43
1 files changed, 43 insertions, 0 deletions
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 @@
+<?php
+/**
+*
+* @package testing
+* @copyright (c) 2011 phpBB Group
+* @license http://opensource.org/licenses/gpl-license.php GNU Public License
+*
+*/
+
+class phpbb_dbal_migration_recall extends phpbb_db_migration
+{
+ function depends_on()
+ {
+ return array();
+ }
+
+ function update_schema()
+ {
+ return array();
+ }
+
+ function update_data()
+ {
+ return array(
+ array('custom', array(array(&$this, 'test_call'))),
+ );
+ }
+
+ // This function should be called 10 times
+ function test_call($input)
+ {
+ global $migrator_test_call_input;
+
+ $migrator_test_call_input = (int) $input;
+
+ if ($migrator_test_call_input < 10)
+ {
+ return ($migrator_test_call_input + 1);
+ }
+
+ return;
+ }
+}