Skip to content

Commit

Permalink
Fixing failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzo committed Apr 25, 2014
1 parent 0d5717b commit 1475c76
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions tests/TestCase/Model/Behavior/TimestampBehaviorTest.php
Expand Up @@ -19,6 +19,7 @@
use Cake\ORM\Entity;
use Cake\ORM\TableRegistry;
use Cake\TestSuite\TestCase;
use Cake\Utility\Time;

/**
* Behavior test case
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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);
}
}

0 comments on commit 1475c76

Please sign in to comment.