summaryrefslogtreecommitdiffstats
path: root/tests/lib/db.php
diff options
context:
space:
mode:
authorAndreas Fischer <bantu@owncloud.com>2013-09-12 22:52:14 +0200
committerAndreas Fischer <bantu@owncloud.com>2013-09-12 23:43:21 +0200
commit20b799b2b49ab301e744d2caab239a278df92ce6 (patch)
tree457b233745c6a1dd2eaa5ca4008184d04035194d /tests/lib/db.php
parentbd1163b7d571f13d7a2a90e559661b4b2e955917 (diff)
downloadnextcloud-server-20b799b2b49ab301e744d2caab239a278df92ce6.tar.gz
nextcloud-server-20b799b2b49ab301e744d2caab239a278df92ce6.zip
Compare objects directly. Also use $expected and $actual.
Diffstat (limited to 'tests/lib/db.php')
-rw-r--r--tests/lib/db.php12
1 files changed, 6 insertions, 6 deletions
diff --git a/tests/lib/db.php b/tests/lib/db.php
index befb52ee198..c87bee4ab99 100644
--- a/tests/lib/db.php
+++ b/tests/lib/db.php
@@ -155,10 +155,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,
@@ -170,16 +170,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.'
);
}