PasswordGetInfoTest.php 970 B

1234567891011121314151617181920212223242526
  1. <?php
  2. class PasswordGetInfoTest extends PHPUnit_Framework_TestCase {
  3. public static function provideInfo() {
  4. return array(
  5. array('foo', array('algo' => 0, 'algoName' => 'unknown', 'options' => array())),
  6. array('$2y$', array('algo' => 0, 'algoName' => 'unknown', 'options' => array())),
  7. array('$2y$07$usesomesillystringfore2uDLvp1Ii2e./U9C8sBjqp8I90dH6hi', array('algo' => PASSWORD_BCRYPT, 'algoName' => 'bcrypt', 'options' => array('cost' => 7))),
  8. array('$2y$10$usesomesillystringfore2uDLvp1Ii2e./U9C8sBjqp8I90dH6hi', array('algo' => PASSWORD_BCRYPT, 'algoName' => 'bcrypt', 'options' => array('cost' => 10))),
  9. );
  10. }
  11. public function testFuncExists() {
  12. $this->assertTrue(function_exists('password_get_info'));
  13. }
  14. /**
  15. * @dataProvider provideInfo
  16. */
  17. public function testInfo($hash, $info) {
  18. $this->assertEquals($info, password_get_info($hash));
  19. }
  20. }