/** * @expectedException BoomCMS\Core\Auth\InvalidPasswordException */ public function testInvalidPasswordExceptionIfInvalidPassword() { $session = $this->getMockSession(); $personRepository = $this->getMockPersonRepository(['findByEmail', 'save']); $permissions = $this->getMock(PermissionsProvider::class); $email = '*****@*****.**'; $password = '******'; $auth = new Auth($session, $personRepository, $permissions); $person = $this->getMockBuilder(Person::class)->setMethods(['checkPassword'])->setConstructorArgs([['id' => 1, 'failed_logins' => 0]])->getMock(); $person->expects($this->once())->method('checkPassword')->with($password)->will($this->returnValue(false)); $personRepository->expects($this->once())->method('findByEmail')->with($this->equalTo($email))->will($this->returnValue($person)); $auth->authenticate($email, $password); }