Skip to content

Commit

Permalink
Try to make some time related test failures go away.
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Sep 21, 2012
1 parent a975026 commit d3ba970
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
Expand Up @@ -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);
}

Expand Down
10 changes: 5 additions & 5 deletions lib/Cake/Test/Case/Utility/FileTest.php
Expand Up @@ -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();
}
Expand All @@ -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();
}
Expand Down

0 comments on commit d3ba970

Please sign in to comment.