public function dispatchCallsStartAuthenticationOnAllActiveEntryPoints() { $this->mockActionRequest->expects($this->any())->method('isDispatched')->will($this->returnValue(true)); $mockAuthenticationToken1 = $this->getMockBuilder(TokenInterface::class)->getMock(); $mockEntryPoint1 = $this->getMockBuilder(EntryPointInterface::class)->getMock(); $mockAuthenticationToken1->expects($this->any())->method('getAuthenticationEntryPoint')->will($this->returnValue($mockEntryPoint1)); $mockAuthenticationToken2 = $this->getMockBuilder(TokenInterface::class)->getMock(); $mockEntryPoint2 = $this->getMockBuilder(EntryPointInterface::class)->getMock(); $mockAuthenticationToken2->expects($this->any())->method('getAuthenticationEntryPoint')->will($this->returnValue($mockEntryPoint2)); $this->mockSecurityContext->expects($this->atLeastOnce())->method('getAuthenticationTokens')->will($this->returnValue([$mockAuthenticationToken1, $mockAuthenticationToken2])); $this->mockFirewall->expects($this->once())->method('blockIllegalRequests')->will($this->throwException(new AuthenticationRequiredException())); $mockEntryPoint1->expects($this->once())->method('startAuthentication')->with($this->mockHttpRequest, $this->mockHttpResponse); $mockEntryPoint2->expects($this->once())->method('startAuthentication')->with($this->mockHttpRequest, $this->mockHttpResponse); try { $this->dispatcher->dispatch($this->mockActionRequest, $this->mockHttpResponse); } catch (AuthenticationRequiredException $exception) { } }