Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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.
  • Loading branch information...
commit 76d21c6d565e5b829d28783b60417d3005773e46 1 parent ea784f6
@markstory markstory authored
Showing with 17 additions and 1 deletion.
  1. +17 −1 lib/Cake/Test/Case/Utility/SecurityTest.php
View
18 lib/Cake/Test/Case/Utility/SecurityTest.php
@@ -147,9 +147,25 @@ public function testHash() {
$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);

0 comments on commit 76d21c6

Please sign in to comment.
Something went wrong with that request. Please try again.