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 ) );