Permalink
Browse files

Try to make some time related test failures go away.

  • Loading branch information...
1 parent a975026 commit d3ba9703a5602caaca4dd039f8065727e8579788 @markstory markstory committed Sep 21, 2012
@@ -271,12 +271,14 @@ public function testWriteArrayValues() {
$expected = array(
'name' => $this->Cookie->name . '[Testing]',
'value' => '[1,2,3]',
- 'expire' => time() + 10,
'path' => '/',
'domain' => '',
'secure' => false,
'httpOnly' => false);
$result = $this->Controller->response->cookie($this->Cookie->name . '[Testing]');
+
+ $this->assertWithinMargin($result['expire'], time() + 10, 1);
+ unset($result['expire']);
$this->assertEquals($expected, $result);
}
@@ -362,11 +362,10 @@ public function testExecutable() {
* @return void
*/
public function testLastAccess() {
- $ts = time();
$someFile = new File(TMP . 'some_file.txt', false);
$this->assertFalse($someFile->lastAccess());
$this->assertTrue($someFile->open());
- $this->assertTrue($someFile->lastAccess() >= $ts);
+ $this->assertWithinMargin($someFile->lastAccess(), time(), 2);
$someFile->close();
$someFile->delete();
}
@@ -377,13 +376,14 @@ public function testLastAccess() {
* @return void
*/
public function testLastChange() {
- $ts = time();
$someFile = new File(TMP . 'some_file.txt', false);
$this->assertFalse($someFile->lastChange());
$this->assertTrue($someFile->open('r+'));
- $this->assertTrue($someFile->lastChange() >= $ts);
+ $this->assertWithinMargin($someFile->lastChange(), time(), 2);
+
$someFile->write('something');
- $this->assertTrue($someFile->lastChange() >= $ts);
+ $this->assertWithinMargin($someFile->lastChange(), time(), 2);
+
$someFile->close();
$someFile->delete();
}

0 comments on commit d3ba970

Please sign in to comment.