mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Try to fix another test failure caused by blowfish.
travis ci seems to have wonky hashing with blowfish on the 5.2 boxes. Skip tests when we know blowfish is messed up.
This commit is contained in:
parent
ea784f68dc
commit
76d21c6d56
1 changed files with 17 additions and 1 deletions
|
@ -147,9 +147,25 @@ class SecurityTest extends CakeTestCase {
|
|||
$this->assertSame(strlen(Security::hash($key, 'sha256', true)), 64);
|
||||
}
|
||||
|
||||
Security::setHash($_hashType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that hash() works with blowfish.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testHashBlowfish() {
|
||||
Security::setCost(10);
|
||||
$test = Security::hash('password', 'blowfish');
|
||||
$this->skipIf(strpos($test, '$2a$') === false, 'Blowfish hashes are incorrect.');
|
||||
|
||||
$_hashType = Security::$hashType;
|
||||
|
||||
$key = 'someKey';
|
||||
$hashType = 'blowfish';
|
||||
Security::setHash($hashType);
|
||||
Security::setCost(10); // ensure default cost
|
||||
|
||||
$this->assertSame(Security::$hashType, $hashType);
|
||||
$this->assertSame(strlen(Security::hash($key, null, false)), 60);
|
||||
|
||||
|
|
Loading…
Reference in a new issue