37 $this->passwordFactory->register(
$type, $config );
63 public function testHashing( $shouldMatch, $hash, $password ) {
64 $hash = $this->passwordFactory->newFromCiphertext( $hash );
65 $password = $this->passwordFactory->newFromPlaintext( $password, $hash );
66 $this->assertSame( $shouldMatch, $hash->equals( $password ) );
73 $hashObj = $this->passwordFactory->newFromCiphertext( $hash );
75 $unserialized = $this->passwordFactory->newFromCiphertext(
$serialized );
76 $this->assertTrue( $hashObj->equals( $unserialized ) );
84 $invalid = $this->passwordFactory->newFromCiphertext(
null );
85 $normal = $this->passwordFactory->newFromCiphertext( $hash );
87 $this->assertFalse( $invalid->equals( $normal ) );
88 $this->assertFalse( $normal->equals( $invalid ) );
107 $fromType = $this->passwordFactory->newFromType(
$type );
108 $fromType->crypt(
'password' );
109 $fromPlaintext = $this->passwordFactory->newFromPlaintext(
'password', $fromType );
110 $this->assertTrue( $fromType->equals( $fromPlaintext ) );
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