mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-09-08 04:22:40 +00:00
avoid failing tests by 1 second off
This commit is contained in:
parent
028ba27522
commit
f8fef907c8
1 changed files with 4 additions and 2 deletions
|
@ -915,7 +915,7 @@ class SecurityComponentTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function testValidateNestedNumericSets() {
|
||||
|
||||
|
||||
$this->Controller->Security->startup($this->Controller);
|
||||
$key = $this->Controller->request->params['_Token']['key'];
|
||||
$unlocked = '';
|
||||
|
@ -1122,13 +1122,15 @@ class SecurityComponentTest extends CakeTestCase {
|
|||
$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');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue