Phalcon\Test\Unit\SecurityTest::testHash PHP Method

testHash() public method

Tests Security::hash
public testHash ( )
    public function testHash()
    {
        $this->specify('The Security::hash works incorrectly', function () {
            $s = new Security();
            $password = 'SomePasswordValue';
            $s->setDefaultHash(Security::CRYPT_DEFAULT);
            expect($s->checkHash($password, $s->hash($password)))->true();
            $s->setDefaultHash(Security::CRYPT_STD_DES);
            expect($s->checkHash($password, $s->hash($password)))->true();
            $s->setDefaultHash(Security::CRYPT_EXT_DES);
            expect($s->checkHash($password, $s->hash($password)))->true();
            $s->setDefaultHash(Security::CRYPT_BLOWFISH);
            expect($s->checkHash($password, $s->hash($password)))->true();
            $s->setDefaultHash(Security::CRYPT_BLOWFISH_A);
            expect($s->checkHash($password, $s->hash($password)))->true();
            $s->setDefaultHash(Security::CRYPT_BLOWFISH_X);
            expect($s->checkHash($password, $s->hash($password)))->true();
            $s->setDefaultHash(Security::CRYPT_BLOWFISH_Y);
            expect($s->checkHash($password, $s->hash($password)))->true();
            $s->setDefaultHash(Security::CRYPT_SHA256);
            expect($s->checkHash($password, $s->hash($password)))->true();
            $s->setDefaultHash(Security::CRYPT_SHA512);
            expect($s->checkHash($password, $s->hash($password)))->true();
        });
    }