1 <?php
2
3 class PasswordNeedsRehashTest extends PHPUnit_Framework_TestCase {
4
5 public static function provideCases() {
6 return array(
7 array('foo', 0, array(), false),
8 array('foo', 1, array(), true),
9 array('$2y$07$usesomesillystringfore2uDLvp1Ii2e./U9C8sBjqp8I90dH6hi', PASSWORD_BCRYPT, array(), true),
10 array('$2y$07$usesomesillystringfore2udlvp1ii2e./u9c8sbjqp8i90dh6hi', PASSWORD_BCRYPT, array('cost' => 7), false),
11 array('$2y$07$usesomesillystringfore2udlvp1ii2e./u9c8sbjqp8i90dh6hi', PASSWORD_BCRYPT, array('cost' => 5), true),
12 );
13 }
14
15 public function testFuncExists() {
16 $this->assertTrue(function_exists('password_needs_rehash'));
17 }
18
19 20 21
22 public function testCases($hash, $algo, $options, $valid) {
23 $this->assertEquals($valid, password_needs_rehash($hash, $algo, $options));
24 }
25
26 }