public function checkPassword($password) { $this->__load(); return parent::checkPassword($password); }
public function testSetPassword() { $user = new User(); $user->setPassword('test'); $property = new \ReflectionProperty($user, 'password'); $property->setAccessible(TRUE); $this->assertTrue($user->checkPassword('test')); $this->assertFalse($user->checkPassword('test1')); $hash = $property->getValue($user); $user->setPassword('test'); $this->assertNotEquals($hash, $property->getValue($user)); // expect different hash for same password $property->setValue($user, sha1('test')); $this->assertFalse($user->checkPassword('test1')); $this->assertEquals(sha1('test'), $property->getValue($user)); $this->assertTrue($user->checkPassword('test')); $this->assertNotEquals(sha1('test'), $property->getValue($user)); // expect password update on check $this->assertNotEquals($hash, $property->getValue($user)); // different from old $this->assertTrue($user->checkPassword('test')); $this->assertFalse($user->checkPassword(sha1('test'))); }