37 $this->passwordFactory->register(
$type, $config );
62 public function testHashing( $shouldMatch, $hash, $password ) {
63 $passwordObj = $this->passwordFactory->newFromCiphertext( $hash );
64 $this->
assertSame( $shouldMatch, $passwordObj->verify( $password ) );
71 $hashObj = $this->passwordFactory->newFromCiphertext( $hash );
73 $unserialized = $this->passwordFactory->newFromCiphertext(
$serialized );
74 $this->
assertEquals( $hashObj->toString(), $unserialized->toString() );
82 $invalid = $this->passwordFactory->newFromCiphertext(
null );
83 $normal = $this->passwordFactory->newFromCiphertext( $hash );
106 $fromType = $this->passwordFactory->newFromType(
$type );
107 $fromType->crypt(
'password' );
108 $fromPlaintext = $this->passwordFactory->newFromPlaintext(
'password', $fromType );
109 $this->
assertTrue( $fromType->verify(
'password' ) );
110 $this->
assertTrue( $fromPlaintext->verify(
'password' ) );
111 $this->
assertFalse( $fromType->verify(
'different password' ) );
112 $this->
assertFalse( $fromPlaintext->verify(
'different password' ) );
115 'newFromPlaintext() should produce instance of the same class as newFromType()'
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two and(2) offer you this license which gives you legal permission to copy
Factory class for creating and checking Password objects.
PasswordFactory $passwordFactory
getTypeConfigs()
Return an array of configs to be used for this class's password type.
testHashing( $shouldMatch, $hash, $password)
providePasswordTests
static providePasswordTests()
An array of tests in the form of (bool, string, string), where the first element is whether the secon...
testInvalidUnequalNormal( $shouldMatch, $hash, $password)
providePasswordTests InvalidPassword
testCrypt( $type)
provideTypes
testStringSerialization( $shouldMatch, $hash, $password)
providePasswordTests
foreach( $res as $row) $serialized