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:
mark_story 2012-09-26 22:23:01 -04:00
parent ea784f68dc
commit 76d21c6d56

View file

@ -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);