Skip to content

Commit

Permalink
add a test that the timestamp is current
Browse files Browse the repository at this point in the history
allowing 3 seconds to prevent off-by-one-second errors
  • Loading branch information
AD7six committed Nov 4, 2013
1 parent dc571ba commit 45aab73
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Cake/Test/TestCase/Model/Behavior/TimestampBehaviorTest.php
Expand Up @@ -174,6 +174,11 @@ 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");

return $this->Behavior;
}

Expand Down

0 comments on commit 45aab73

Please sign in to comment.