diff options
author | Andreas Fischer <bantu@owncloud.com> | 2013-09-13 00:52:14 +0400 |
---|---|---|
committer | Andreas Fischer <bantu@owncloud.com> | 2013-09-24 02:00:24 +0400 |
commit | f63c9a24eb420b75906791bb09be440f43a48f29 (patch) | |
tree | bc7a950880e425873d6d1620c9eb37a010b41652 /tests | |
parent | a8d7f1feae3580d12b3c0ca6bd9f3bddc1c2ab22 (diff) |
Compare objects directly. Also use $expected and $actual.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/db.php | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/tests/lib/db.php b/tests/lib/db.php index d11b828844f..6768997c5de 100644 --- a/tests/lib/db.php +++ b/tests/lib/db.php @@ -140,10 +140,10 @@ class Test_DB extends PHPUnit_Framework_TestCase { $column = 'timestamptest'; $expectedFormat = 'Y-m-d H:i:s'; - $now = new \DateTime; + $expected = new \DateTime; $query = OC_DB::prepare("INSERT INTO `$table` (`$column`) VALUES (?)"); - $result = $query->execute(array($now->format($expectedFormat))); + $result = $query->execute(array($expected->format($expectedFormat))); $this->assertEquals( 1, $result, @@ -155,16 +155,16 @@ class Test_DB extends PHPUnit_Framework_TestCase { $result = $query->execute(array($id)); $row = $result->fetchRow(); - $dateFromDb = \DateTime::createFromFormat($expectedFormat, $row[$column]); + $actual = \DateTime::createFromFormat($expectedFormat, $row[$column]); $this->assertInstanceOf( '\DateTime', - $dateFromDb, + $actual, "Database failed to return dates in the format '$expectedFormat'." ); $this->assertEquals( - $now->format('c u'), - $dateFromDb->format('c u'), + $expected, + $actual, 'Failed asserting that the returned date is the same as the inserted.' ); } |