Change-Id: I8d655a4f7a57f2186b1457d956af74bf21d4db08
* @inheritDoc
*/
public function equals( $other ) {
* @inheritDoc
*/
public function equals( $other ) {
+ wfDeprecated( __METHOD__, '1.33' );
+
if ( is_string( $other ) ) {
return $this->verify( $other );
}
if ( is_string( $other ) ) {
return $this->verify( $other );
}
}
public function equals( $other ) {
}
public function equals( $other ) {
+ wfDeprecated( __METHOD__, '1.33' );
+
* custom comparison, but it is not recommended unless necessary.
*
* @deprecated since 1.33, use verify()
* custom comparison, but it is not recommended unless necessary.
*
* @deprecated since 1.33, use verify()
*
* @param Password|string $other The other password
* @return bool True if equal, false otherwise
*/
public function equals( $other ) {
*
* @param Password|string $other The other password
* @return bool True if equal, false otherwise
*/
public function equals( $other ) {
+ wfDeprecated( __METHOD__, '1.33' );
+
if ( is_string( $other ) ) {
return $this->verify( $other );
}
if ( is_string( $other ) ) {
return $this->verify( $other );
}
$invalid = $this->passwordFactory->newFromCiphertext( null );
$normal = $this->passwordFactory->newFromCiphertext( $hash );
$invalid = $this->passwordFactory->newFromCiphertext( null );
$normal = $this->passwordFactory->newFromCiphertext( $hash );
- $this->assertFalse( $invalid->equals( $normal ) );
- $this->assertFalse( $normal->equals( $invalid ) );
$this->assertFalse( $invalid->verify( $hash ) );
}
$this->assertFalse( $invalid->verify( $hash ) );
}
}
public function testGetPassword() {
}
public function testGetPassword() {
+ /** @var BotPassword $bp */
$bp = TestingAccessWrapper::newFromObject( BotPassword::newFromCentralId( 42, 'BotPassword' ) );
$password = $bp->getPassword();
$this->assertInstanceOf( Password::class, $password );
$bp = TestingAccessWrapper::newFromObject( BotPassword::newFromCentralId( 42, 'BotPassword' ) );
$password = $bp->getPassword();
$this->assertInstanceOf( Password::class, $password );
- $this->assertTrue( $password->equals( 'foobaz' ) );
+ $this->assertTrue( $password->verify( 'foobaz' ) );
$bp->centralId = 44;
$password = $bp->getPassword();
$bp->centralId = 44;
$password = $bp->getPassword();
$this->assertEquals( $bp->getToken(), $bp2->getToken() );
$this->assertEquals( $bp->getRestrictions(), $bp2->getRestrictions() );
$this->assertEquals( $bp->getGrants(), $bp2->getGrants() );
$this->assertEquals( $bp->getToken(), $bp2->getToken() );
$this->assertEquals( $bp->getRestrictions(), $bp2->getRestrictions() );
$this->assertEquals( $bp->getGrants(), $bp2->getGrants() );
+ /** @var Password $pw */
$pw = TestingAccessWrapper::newFromObject( $bp )->getPassword();
if ( $password === null ) {
$this->assertInstanceOf( InvalidPassword::class, $pw );
} else {
$pw = TestingAccessWrapper::newFromObject( $bp )->getPassword();
if ( $password === null ) {
$this->assertInstanceOf( InvalidPassword::class, $pw );
} else {
- $this->assertTrue( $pw->equals( $password ) );
+ $this->assertTrue( $pw->verify( $password ) );
}
$token = $bp->getToken();
}
$token = $bp->getToken();
$bp2 = BotPassword::newFromCentralId( 42, 'TestSave', BotPassword::READ_LATEST );
$this->assertInstanceOf( BotPassword::class, $bp2 );
$this->assertEquals( $bp->getToken(), $bp2->getToken() );
$bp2 = BotPassword::newFromCentralId( 42, 'TestSave', BotPassword::READ_LATEST );
$this->assertInstanceOf( BotPassword::class, $bp2 );
$this->assertEquals( $bp->getToken(), $bp2->getToken() );
+ /** @var Password $pw */
$pw = TestingAccessWrapper::newFromObject( $bp )->getPassword();
if ( $password === null ) {
$this->assertInstanceOf( InvalidPassword::class, $pw );
} else {
$pw = TestingAccessWrapper::newFromObject( $bp )->getPassword();
if ( $password === null ) {
$this->assertInstanceOf( InvalidPassword::class, $pw );
} else {
- $this->assertTrue( $pw->equals( $password ) );
+ $this->assertTrue( $pw->verify( $password ) );
}
$passwordHash = $passwordFactory->newFromPlaintext( 'XXX' );
$token = $bp->getToken();
$this->assertTrue( $bp->save( 'update', $passwordHash ) );
$this->assertNotEquals( $token, $bp->getToken() );
}
$passwordHash = $passwordFactory->newFromPlaintext( 'XXX' );
$token = $bp->getToken();
$this->assertTrue( $bp->save( 'update', $passwordHash ) );
$this->assertNotEquals( $token, $bp->getToken() );
+ /** @var Password $pw */
$pw = TestingAccessWrapper::newFromObject( $bp )->getPassword();
$pw = TestingAccessWrapper::newFromObject( $bp )->getPassword();
- $this->assertTrue( $pw->equals( 'XXX' ) );
+ $this->assertTrue( $pw->verify( 'XXX' ) );
$this->assertTrue( $bp->delete() );
$this->assertFalse( $bp->isSaved() );
$this->assertTrue( $bp->delete() );
$this->assertFalse( $bp->isSaved() );