Skip to content

Commit a2bc539

Browse files
committed
Migration test case
1 parent ed583ca commit a2bc539

2 files changed

Lines changed: 46 additions & 0 deletions

File tree

tests/system/Database/BaseQueryTest.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,32 @@ public function testStoresDuration()
4343

4444
//--------------------------------------------------------------------
4545

46+
public function testGetStartTime()
47+
{
48+
$query = new Query($this->db);
49+
50+
$start = microtime(true);
51+
52+
$query->setDuration($start, $start + 5);
53+
54+
$this->assertEquals(round($start, 4), $query->getStartTime(true));
55+
}
56+
57+
//--------------------------------------------------------------------
58+
59+
public function testGetStartTimeNumberFormat()
60+
{
61+
$query = new Query($this->db);
62+
63+
$start = microtime(true);
64+
65+
$query->setDuration($start, $start + 5);
66+
67+
$this->assertEquals(number_format($start, 6), $query->getStartTime());
68+
}
69+
70+
//--------------------------------------------------------------------
71+
4672
public function testsStoresErrorInformation()
4773
{
4874
$query = new Query($this->db);

tests/system/Database/Migrations/MigrationRunnerTest.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,4 +382,24 @@ public function testCurrentSuccess()
382382
$this->assertEquals('001', $version);
383383
$this->assertTrue(db_connect()->tableExists('foo'));
384384
}
385+
386+
public function testLatestAll()
387+
{
388+
$config = $this->config;
389+
$config->type = 'sequential';
390+
$runner = new MigrationRunner($config);
391+
$runner->setSilent(false);
392+
393+
$runner = $runner->setPath($this->start);
394+
395+
vfsStream::copyFromFileSystem(
396+
TESTPATH . '_support/Database/SupportMigrations',
397+
$this->root
398+
);
399+
400+
$version = $runner->latestAll();
401+
402+
$this->assertTrue($version);
403+
$this->assertTrue(db_connect()->tableExists('foo'));
404+
}
385405
}

0 commit comments

Comments
 (0)