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