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