checkPreAuth(new SymfonyUser('sdf', null)); } catch (\Exception $ex) { $this->fail('UserChecker should not throw exception in checkPreAuth(), ' . $ex->getMessage()); } $this->assertTrue(true); } public function testCheckPostAuthReturnsOnUnknownUserClass() { $sut = new UserChecker(); try { $sut->checkPostAuth(new SymfonyUser('sdf', null)); } catch (\Exception $ex) { $this->fail('UserChecker should not throw exception in checkPostAuth(), ' . $ex->getMessage()); } $this->assertTrue(true); } /** * @expectedException \Symfony\Component\Security\Core\Exception\DisabledException * @expectedExceptionMessage User account is disabled. */ public function testDisabledCannotLoginInCheckPreAuth() { (new UserChecker())->checkPreAuth((new User())->setEnabled(false)); } /** * @expectedException \Symfony\Component\Security\Core\Exception\DisabledException * @expectedExceptionMessage User account is disabled. */ public function testDisabledCannotLoginInCheckPostAuth() { (new UserChecker())->checkPostAuth((new User())->setEnabled(false)); } }