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