diff options
| author | Nils Adermann <naderman@naderman.de> | 2011-08-07 19:10:38 -0400 |
|---|---|---|
| committer | Nathan Guse <nathaniel.guse@gmail.com> | 2013-01-09 16:39:59 -0600 |
| commit | d304b6449db6e7c6f3c9058062aca0c641f023a4 (patch) | |
| tree | 49e4db234f5488211c78aa67b887d7a08f8e4b36 /tests/dbal | |
| parent | f817e20f287a21e2dddfba9721f5e02dce162d29 (diff) | |
| download | forums-d304b6449db6e7c6f3c9058062aca0c641f023a4.tar forums-d304b6449db6e7c6f3c9058062aca0c641f023a4.tar.gz forums-d304b6449db6e7c6f3c9058062aca0c641f023a4.tar.bz2 forums-d304b6449db6e7c6f3c9058062aca0c641f023a4.tar.xz forums-d304b6449db6e7c6f3c9058062aca0c641f023a4.zip | |
[feature/migrations] Store start and end time of migrations
PHPBB3-9737
Diffstat (limited to 'tests/dbal')
| -rw-r--r-- | tests/dbal/migrator_test.php | 33 |
1 files changed, 27 insertions, 6 deletions
diff --git a/tests/dbal/migrator_test.php b/tests/dbal/migrator_test.php index 1e7d1343fc..dd194d7c05 100644 --- a/tests/dbal/migrator_test.php +++ b/tests/dbal/migrator_test.php @@ -26,7 +26,7 @@ class phpbb_dbal_migrator_test extends phpbb_database_test_case return $this->createXMLDataSet(dirname(__FILE__).'/fixtures/migrator.xml'); } - public function setup() + public function setUp() { parent::setup(); @@ -35,6 +35,12 @@ class phpbb_dbal_migrator_test extends phpbb_database_test_case $this->migrator = new phpbb_db_migrator($this->db, $this->db_tools, MIGRATIONS_TABLE); } + public function tearDown() + { + // cleanup + $this->db_tools->sql_column_remove('phpbb_config', 'extra_column'); + } + public function test_update() { $this->migrator->set_migrations(array('phpbb_dbal_migration_dummy')); @@ -43,6 +49,16 @@ class phpbb_dbal_migrator_test extends phpbb_database_test_case $this->migrator->update(); $this->assertFalse($this->migrator->finished()); + $this->assertSqlResultEquals( + array(array('success' => '1')), + "SELECT 1 as success + FROM phpbb_migrations + WHERE migration_name = 'phpbb_dbal_migration_dummy' + AND migration_start_time >= " . (time() - 1) . " + AND migration_start_time <= " . (time() + 1), + 'Start time set correctly' + ); + // data $this->migrator->update(); $this->assertTrue($this->migrator->finished()); @@ -53,8 +69,16 @@ class phpbb_dbal_migrator_test extends phpbb_database_test_case 'Dummy migration created extra_column with value 1 in all rows.' ); - // cleanup - $this->db_tools->sql_column_remove('phpbb_config', 'extra_column'); + $this->assertSqlResultEquals( + array(array('success' => '1')), + "SELECT 1 as success + FROM phpbb_migrations + WHERE migration_name = 'phpbb_dbal_migration_dummy' + AND migration_start_time <= migration_end_time + AND migration_end_time >= " . (time() - 1) . " + AND migration_end_time <= " . (time() + 1), + 'End time set correctly' + ); } public function test_unfulfillable() @@ -73,8 +97,5 @@ class phpbb_dbal_migrator_test extends phpbb_database_test_case "SELECT extra_column FROM phpbb_config WHERE config_name = 'foo'", 'Dummy migration was run, even though an unfulfillable migration was found.' ); - - // cleanup - $this->db_tools->sql_column_remove('phpbb_config', 'extra_column'); } } |
