summaryrefslogtreecommitdiff
path: root/vendor/ircmaxell/password-compat/test/Unit/PasswordNeedsRehashTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/ircmaxell/password-compat/test/Unit/PasswordNeedsRehashTest.php')
-rw-r--r--vendor/ircmaxell/password-compat/test/Unit/PasswordNeedsRehashTest.php26
1 files changed, 26 insertions, 0 deletions
diff --git a/vendor/ircmaxell/password-compat/test/Unit/PasswordNeedsRehashTest.php b/vendor/ircmaxell/password-compat/test/Unit/PasswordNeedsRehashTest.php
new file mode 100644
index 00000000..c2932dc6
--- /dev/null
+++ b/vendor/ircmaxell/password-compat/test/Unit/PasswordNeedsRehashTest.php
@@ -0,0 +1,26 @@
+<?php
+
+class PasswordNeedsRehashTest extends PHPUnit_Framework_TestCase {
+
+ public static function provideCases() {
+ return array(
+ array('foo', 0, array(), false),
+ array('foo', 1, array(), true),
+ array('$2y$07$usesomesillystringfore2uDLvp1Ii2e./U9C8sBjqp8I90dH6hi', PASSWORD_BCRYPT, array(), true),
+ array('$2y$07$usesomesillystringfore2udlvp1ii2e./u9c8sbjqp8i90dh6hi', PASSWORD_BCRYPT, array('cost' => 7), false),
+ array('$2y$07$usesomesillystringfore2udlvp1ii2e./u9c8sbjqp8i90dh6hi', PASSWORD_BCRYPT, array('cost' => 5), true),
+ );
+ }
+
+ public function testFuncExists() {
+ $this->assertTrue(function_exists('password_needs_rehash'));
+ }
+
+ /**
+ * @dataProvider provideCases
+ */
+ public function testCases($hash, $algo, $options, $valid) {
+ $this->assertEquals($valid, password_needs_rehash($hash, $algo, $options));
+ }
+
+} \ No newline at end of file