Skip to content

Commit

Permalink
avoid failing tests by 1 second off
Browse files Browse the repository at this point in the history
  • Loading branch information
ceeram committed Feb 10, 2012
1 parent 028ba27 commit f8fef90
Showing 1 changed file with 4 additions and 2 deletions.
Expand Up @@ -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 = '';
Expand Down Expand Up @@ -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');
}
}

Expand Down

0 comments on commit f8fef90

Please sign in to comment.