lithium\tests\cases\security\PasswordTest::testCheck PHP Метод

testCheck() публичный Метод

Tests the Password::check() method to make sure that it returns either true or false, depending on the input.
public testCheck ( )
    public function testCheck()
    {
        $this->skipIf(!CRYPT_BLOWFISH, 'Blowfish is not supported.');
        $salt = '$2a$07$l1th1um1saw3some12345678$';
        $hash = Password::hash($this->_password, $salt);
        $this->assertTrue(Password::check($this->_password, $hash));
        $hash = Password::hash($this->_password);
        $this->assertTrue(Password::check($this->_password, $hash));
        $wrong = 'wr0ng';
        $this->assertFalse(Password::check($wrong, $hash));
    }