Skip to content
Permalink
Browse files

increases time window in CSRF token expiry tests to 2 seconds

travis-cs failed with 1 second margin
  • Loading branch information...
Schlaefer committed Jul 6, 2014
1 parent 9fa7afa commit 1e961a8aac37aefdd71694b32fd395f90692117f
Showing with 2 additions and 4 deletions.
  1. +2 −4 lib/Cake/Test/Case/Controller/Component/SecurityComponentTest.php
@@ -1214,8 +1214,7 @@ public function testCsrfSettingMultipleNonces() {
$token = $this->Security->Session->read('_Token');
$this->assertEquals(2, count($token['csrfTokens']), 'Missing the csrf token.');
foreach ($token['csrfTokens'] as $expires) {
$diff = $csrfExpires - $expires;
$this->assertTrue($diff === 0 || $diff === 1, 'Token expiry does not match');
$this->assertWithinMargin($expires, $csrfExpires, 2, 'Token expiry does not match');
}
}
@@ -1264,8 +1263,7 @@ public function testCsrfReusableTokenRenewal() {
$this->Security->startup($this->Controller);
$tokens = $this->Security->Session->read('_Token.csrfTokens');
$diff = strtotime($csrfExpires) - $tokens['token'];
$this->assertTrue($diff === 0 || $diff === 1, 'Token expiry was not renewed');
$this->assertWithinMargin($tokens['token'], strtotime($csrfExpires), 2, 'Token expiry was not renewed');
}
/**

0 comments on commit 1e961a8

Please sign in to comment.
You can’t perform that action at this time.