mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +00:00
Try to make some time related test failures go away.
This commit is contained in:
parent
a9750264e4
commit
d3ba9703a5
2 changed files with 8 additions and 6 deletions
|
@ -271,12 +271,14 @@ class CookieComponentTest extends CakeTestCase {
|
|||
$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 @@ class FileTest extends CakeTestCase {
|
|||
* @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 @@ class FileTest extends CakeTestCase {
|
|||
* @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();
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue