Timestamp test is no longer necessary as we rely on Doctrine and DateTime.

This commit is contained in:
Andreas Fischer 2013-11-26 12:22:08 +01:00
parent 3bbaba1eca
commit 06df3822a0
1 changed files with 0 additions and 38 deletions

View File

@ -145,42 +145,4 @@ class Test_DB extends PHPUnit_Framework_TestCase {
$this->assertEquals(1, $result->numRows());
}
/**
* Tests whether the database is configured so it accepts and returns dates
* in the expected format.
*/
public function testTimestampDateFormat() {
$table = '*PREFIX*'.$this->test_prefix.'timestamp';
$column = 'timestamptest';
$expectedFormat = 'Y-m-d H:i:s';
$expected = new \DateTime;
$query = OC_DB::prepare("INSERT INTO `$table` (`$column`) VALUES (?)");
$result = $query->execute(array($expected->format($expectedFormat)));
$this->assertEquals(
1,
$result,
"Database failed to accept dates in the format '$expectedFormat'."
);
$id = OC_DB::insertid($table);
$query = OC_DB::prepare("SELECT * FROM `$table` WHERE `id` = ?");
$result = $query->execute(array($id));
$row = $result->fetchRow();
$actual = \DateTime::createFromFormat($expectedFormat, $row[$column]);
$this->assertInstanceOf(
'\DateTime',
$actual,
"Database failed to return dates in the format '$expectedFormat'."
);
$this->assertEquals(
$expected,
$actual,
'Failed asserting that the returned date is the same as the inserted.'
);
}
}