Skip to content

Commit

Permalink
Fix test on PHP 8.4
Browse files Browse the repository at this point in the history
  • Loading branch information
ADmad committed Jul 25, 2024
1 parent 55330b5 commit 0567f3c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion tests/TestCase/Authenticator/CookieAuthenticatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -301,8 +301,12 @@ public function testPersistIdentity()
$this->assertArrayHasKey('response', $result);
$this->assertInstanceOf(RequestInterface::class, $result['request']);
$this->assertInstanceOf(ResponseInterface::class, $result['response']);
$hashCost = '10';
if (PHP_VERSION_ID >= 80400) {
$hashCost = '12';
}
$this->assertStringContainsString(
'CookieAuth=%5B%22mariano%22%2C%22%242y%2410%24', // `CookieAuth=["mariano","$2y$10$`
'CookieAuth=%5B%22mariano%22%2C%22%242y%24' . $hashCost . '%24', // `CookieAuth=["mariano","$2y$10$`
$result['response']->getHeaderLine('Set-Cookie')
);
$this->assertStringContainsString(
Expand Down
6 changes: 5 additions & 1 deletion tests/TestCase/PasswordHasher/LegacyPasswordHasherTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,11 @@ public function testNeedsRehash()
$hasher = new LegacyPasswordHasher();
$this->assertTrue($hasher->needsRehash(md5('foo')));
$this->assertTrue($hasher->needsRehash('bar'));
$this->assertFalse($hasher->needsRehash('$2y$10$juOA0XVFpvZa0KTxRxEYVuX5kIS7U1fKDRcxyYhhUQECN1oHYnBMy'));
$hashCost = '10';
if (PHP_VERSION_ID >= 80400) {
$hashCost = '12';
}
$this->assertFalse($hasher->needsRehash('$2y$' . $hashCost . '$juOA0XVFpvZa0KTxRxEYVuX5kIS7U1fKDRcxyYhhUQECN1oHYnBMy'));
}

/**
Expand Down

0 comments on commit 0567f3c

Please sign in to comment.