logger = $this->createMock(AuditLogger::class); $this->security = new Security($this->logger); $this->user = $this->createMock(IUser::class); $this->user->method('getUID')->willReturn('myuid'); $this->user->method('getDisplayName')->willReturn('mydisplayname'); } public function testTwofactorFailed() { $this->logger->expects($this->once()) ->method('info') ->with( $this->equalTo('Failed two factor attempt by user mydisplayname (myuid) with provider myprovider'), ['app' => 'admin_audit'] ); $provider = $this->createMock(IProvider::class); $provider->method('getDisplayName') ->willReturn('myprovider'); $this->security->twofactorFailed($this->user, $provider); } public function testTwofactorSuccess() { $this->logger->expects($this->once()) ->method('info') ->with( $this->equalTo('Successful two factor attempt by user mydisplayname (myuid) with provider myprovider'), ['app' => 'admin_audit'] ); $provider = $this->createMock(IProvider::class); $provider->method('getDisplayName') ->willReturn('myprovider'); $this->security->twofactorSuccess($this->user, $provider); } }