Skip to content

Commit

Permalink
Merge pull request #1541 from alcaeus/fix-millisecond-test-error
Browse files Browse the repository at this point in the history
Correctly format microseconds in test
  • Loading branch information
alcaeus committed Dec 25, 2016
2 parents b69fa10 + 2480cda commit 2f1eb74
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tests/Doctrine/ODM/MongoDB/Tests/Types/TypeTest.php
Expand Up @@ -79,7 +79,7 @@ public function testConvertDatePreservesMilliseconds()
$expectedDate = clone $date;

$cleanMicroseconds = (int) floor(((int) $date->format('u')) / 1000) * 1000;
$expectedDate->modify($date->format('H:i:s') . '.' . $cleanMicroseconds);
$expectedDate->modify($date->format('H:i:s') . '.' . str_pad($cleanMicroseconds, 6, '0', STR_PAD_LEFT));

$type = Type::getType(Type::DATE);
$this->assertEquals($expectedDate, $type->convertToPHPValue($type->convertToDatabaseValue($date)));
Expand Down

0 comments on commit 2f1eb74

Please sign in to comment.