PasswordVerifyTest.php 938 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. class PasswordVerifyTest extends PHPUnit_Framework_TestCase {
  3. public function testFuncExists() {
  4. $this->assertTrue(function_exists('password_verify'));
  5. }
  6. public function testFailedType() {
  7. $this->assertFalse(password_verify(123, 123));
  8. }
  9. public function testSaltOnly() {
  10. $this->assertFalse(password_verify('foo', '$2a$07$usesomesillystringforsalt$'));
  11. }
  12. public function testInvalidPassword() {
  13. $this->assertFalse(password_verify('rasmusler', '$2a$07$usesomesillystringfore2uDLvp1Ii2e./U9C8sBjqp8I90dH6hi'));
  14. }
  15. public function testValidPassword() {
  16. $this->assertTrue(password_verify('rasmuslerdorf', '$2a$07$usesomesillystringfore2uDLvp1Ii2e./U9C8sBjqp8I90dH6hi'));
  17. }
  18. public function testInValidHash() {
  19. $this->assertFalse(password_verify('rasmuslerdorf', '$2a$07$usesomesillystringfore2uDLvp1Ii2e./U9C8sBjqp8I90dH6hj'));
  20. }
  21. }