checkPreAuth($user); } catch (\Exception $ex) { $this->fail('UserChecker should not throw exception in checkPreAuth()'); } $this->assertTrue(true); } /** * @expectedException \Symfony\Component\Security\Core\Exception\LockedException */ public function testDisabledCannotLogin() { $sut = new UserChecker(); $user = new User(); $user->setEnabled(false); $sut->checkPostAuth($user); } public function testCheckPostAuth() { $sut = new UserChecker(); $mock = $this->getMockBuilder(UserInterface::class)->setMethods(['isEnabled'])->getMockForAbstractClass(); $mock->expects($this->never())->method('isEnabled')->willReturn(false); $sut->checkPostAuth($mock); $this->assertTrue(true); } }