Skip to content
This repository
Browse code

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
Mark Story authored September 26, 2012
18  lib/Cake/Test/Case/Utility/SecurityTest.php
@@ -147,9 +147,25 @@ public function testHash() {
147 147
 			$this->assertSame(strlen(Security::hash($key, 'sha256', true)), 64);
148 148
 		}
149 149
 
  150
+		Security::setHash($_hashType);
  151
+	}
  152
+
  153
+/**
  154
+ * Test that hash() works with blowfish.
  155
+ *
  156
+ * @return void
  157
+ */
  158
+	public function testHashBlowfish() {
  159
+		Security::setCost(10);
  160
+		$test = Security::hash('password', 'blowfish');
  161
+		$this->skipIf(strpos($test, '$2a$') === false, 'Blowfish hashes are incorrect.');
  162
+
  163
+		$_hashType = Security::$hashType;
  164
+	
  165
+		$key = 'someKey';
150 166
 		$hashType = 'blowfish';
151 167
 		Security::setHash($hashType);
152  
-		Security::setCost(10); // ensure default cost
  168
+
153 169
 		$this->assertSame(Security::$hashType, $hashType);
154 170
 		$this->assertSame(strlen(Security::hash($key, null, false)), 60);
155 171
 

0 notes on commit 76d21c6

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