Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

avoid failing tests by 1 second off

  • Loading branch information...
commit f8fef907c88d7ce0bd67e2d69b89b013b09db758 1 parent 028ba27
@ceeram ceeram authored
View
6 lib/Cake/Test/Case/Controller/Component/SecurityComponentTest.php
@@ -915,7 +915,7 @@ public function testValidateHasManyRecordsPass() {
* @return void
*/
public function testValidateNestedNumericSets() {
-
+
$this->Controller->Security->startup($this->Controller);
$key = $this->Controller->request->params['_Token']['key'];
$unlocked = '';
@@ -1122,13 +1122,15 @@ public function testCsrfSettingMultipleNonces() {
$this->Security->validatePost = false;
$this->Security->csrfCheck = true;
$this->Security->csrfExpires = '+10 minutes';
+ $csrfExpires = strtotime('+10 minutes');
$this->Security->startup($this->Controller);
$this->Security->startup($this->Controller);
$token = $this->Security->Session->read('_Token');
$this->assertEquals(count($token['csrfTokens']), 2, 'Missing the csrf token.');
foreach ($token['csrfTokens'] as $key => $expires) {
- $this->assertEquals(strtotime('+10 minutes'), $expires, 'Token expiry does not match');
+ $diff = $csrfExpires - $expires;
+ $this->assertTrue($diff === 0 || $diff === 1, 'Token expiry does not match');
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.