public function dispatchRethrowsAuthenticationRequiredExceptionIfSecurityContextDoesNotContainAnyAuthenticationToken() { $this->mockActionRequest->expects($this->any())->method('isDispatched')->will($this->returnValue(true)); $this->mockSecurityContext->expects($this->atLeastOnce())->method('getAuthenticationTokens')->will($this->returnValue([])); $this->mockFirewall->expects($this->once())->method('blockIllegalRequests')->will($this->throwException(new AuthenticationRequiredException())); $this->dispatcher->dispatch($this->mockActionRequest, $this->mockHttpResponse); }