Skip to content

Commit 3eb82d3

Browse files
author
Malte Riesch
committed
treat timestamp as date columns so they can be normalised when comparing
1 parent da1da20 commit 3eb82d3

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

lib/TestDbAcle/Db/Mysql/Table/Column.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public function isAutoIncrement()
2121

2222
public function isDateTime()
2323
{
24-
return strpos($this->meta['Type'], 'date') !== false;
24+
return strpos($this->meta['Type'], 'date') !== false || strpos($this->meta['Type'], 'timestamp') !== false;
2525
}
2626

2727
public function isNullable()

tests/TestDbAcle/Db/Mysql/Table/ColumnTest renamed to tests/TestDbAcle/Db/Mysql/Table/ColumnTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,12 @@ public function test_isDateTime() {
1414

1515
$columnDate = new \TestDbAcle\Db\Mysql\Table\Column(array('Type' => 'date'));
1616
$columnDateTime = new \TestDbAcle\Db\Mysql\Table\Column(array('Type' => 'datetime'));
17+
$columnTimestamp = new \TestDbAcle\Db\Mysql\Table\Column(array('Type' => 'timestamp'));
1718
$columnTinyBlob = new \TestDbAcle\Db\Mysql\Table\Column(array('Type' => 'tinyblob'));
18-
19+
1920
$this->assertTrue($columnDate->isDateTime());
2021
$this->assertTrue($columnDateTime->isDateTime());
22+
$this->assertTrue($columnTimestamp->isDateTime());
2123
$this->assertFalse($columnTinyBlob->isDateTime());
2224

2325
}

0 commit comments

Comments
 (0)