public function testGetAuthorizationResponseOkWithState()
 {
     $code = '123';
     $stateHash = 'abc';
     $state = $this->createStateMock();
     $dispatcher = new Dispatcher();
     $httpRequest = $this->createHttpRequestMock(array('code' => $code, 'state' => $stateHash));
     $response = $this->createResponseMock();
     $responseFactory = $this->createResponseFactoryMock($code, $response, $stateHash);
     $dispatcher->setResponseFactory($responseFactory);
     $stateManager = $this->createStateManagerMock($stateHash);
     $dispatcher->setStateManager($stateManager);
     $this->assertSame($response, $dispatcher->getAuthorizationResponse($httpRequest));
     $this->assertSame($httpRequest, $dispatcher->getLastHttpRequestFromServer());
     $this->assertSame($response, $dispatcher->getLastResponse());
 }