From 1475c76c3bbb54ed02720cfa4b939d3520b64163 Mon Sep 17 00:00:00 2001 From: Jose Lorenzo Rodriguez Date: Fri, 25 Apr 2014 09:29:42 +0200 Subject: [PATCH] Fixing failing tests --- .../Model/Behavior/TimestampBehaviorTest.php | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/tests/TestCase/Model/Behavior/TimestampBehaviorTest.php b/tests/TestCase/Model/Behavior/TimestampBehaviorTest.php index 4f388651ffb..ddf9c2bbe6c 100644 --- a/tests/TestCase/Model/Behavior/TimestampBehaviorTest.php +++ b/tests/TestCase/Model/Behavior/TimestampBehaviorTest.php @@ -19,6 +19,7 @@ use Cake\ORM\Entity; use Cake\ORM\TableRegistry; use Cake\TestSuite\TestCase; +use Cake\Utility\Time; /** * Behavior test case @@ -213,10 +214,8 @@ public function testGetTimestamp() { 'Should return a timestamp object' ); - $now = time(); - $ts = $return->getTimestamp(); - - $this->assertLessThan(3, abs($now - $ts), "Timestamp is expected to within 3 seconds of the current timestamp"); + $now = Time::now(); + $this->assertEquals($now, $return); return $this->Behavior; } @@ -374,12 +373,8 @@ public function testSaveTriggersInsert() { $row = $table->find('all')->where(['id' => $entity->id])->first(); - $now = time(); - - $storedValue = $row->created->getTimestamp(); - $this->assertLessThan(3, abs($storedValue - $now), "The stored created timestamp is expected to within 3 seconds of the current timestamp"); - - $storedValue = $row->updated->getTimestamp(); - $this->assertLessThan(3, abs($storedValue - $now), "The stored updated timestamp is expected to within 3 seconds of the current timestamp"); + $now = Time::now(); + $this->assertEquals($now, $row->created); + $this->assertEquals($now, $row->updated); } }