From 76d21c6d565e5b829d28783b60417d3005773e46 Mon Sep 17 00:00:00 2001 From: mark_story Date: Wed, 26 Sep 2012 22:23:01 -0400 Subject: [PATCH] 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. --- lib/Cake/Test/Case/Utility/SecurityTest.php | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/lib/Cake/Test/Case/Utility/SecurityTest.php b/lib/Cake/Test/Case/Utility/SecurityTest.php index ea7d6fa29..c6c017df6 100644 --- a/lib/Cake/Test/Case/Utility/SecurityTest.php +++ b/lib/Cake/Test/Case/Utility/SecurityTest.php @@ -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);