1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-31 05:50:42 +02:00

[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
This commit is contained in:
Nathan Guse
2013-01-10 12:49:13 -06:00
parent 44c10f661e
commit ddb1eaab68
2 changed files with 66 additions and 0 deletions

View File

@@ -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);
}
}