class TestMultipleHttpKernel

Hierarchy

Expanded class hierarchy of TestMultipleHttpKernel

File

drupal/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/HttpCache/TestMultipleHttpKernel.php, line 21

Namespace

Symfony\Component\HttpKernel\Tests\HttpCache
View source
class TestMultipleHttpKernel extends HttpKernel implements ControllerResolverInterface {
  protected $bodies;
  protected $statuses;
  protected $headers;
  protected $catch;
  protected $call;
  protected $backendRequest;
  public function __construct($responses) {
    $this->bodies = array();
    $this->statuses = array();
    $this->headers = array();
    $this->call = false;
    foreach ($responses as $response) {
      $this->bodies[] = $response['body'];
      $this->statuses[] = $response['status'];
      $this->headers[] = $response['headers'];
    }
    parent::__construct(new EventDispatcher(), $this);
  }
  public function getBackendRequest() {
    return $this->backendRequest;
  }
  public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = false) {
    $this->backendRequest = $request;
    return parent::handle($request, $type, $catch);
  }
  public function getController(Request $request) {
    return array(
      $this,
      'callController',
    );
  }
  public function getArguments(Request $request, $controller) {
    return array(
      $request,
    );
  }
  public function callController(Request $request) {
    $this->called = true;
    $response = new Response(array_shift($this->bodies), array_shift($this->statuses), array_shift($this->headers));
    return $response;
  }
  public function hasBeenCalled() {
    return $this->called;
  }
  public function reset() {
    $this->call = false;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
HttpKernel::$dispatcher protected property
HttpKernel::$resolver protected property
HttpKernel::filterResponse private function Filters a response object.
HttpKernel::handleException private function Handles an exception by trying to convert it to a Response.
HttpKernel::handleRaw private function Handles a request to convert it to a response.
HttpKernel::terminate public function @api Overrides TerminableInterface::terminate
HttpKernel::varToString private function
HttpKernelInterface::MASTER_REQUEST constant
HttpKernelInterface::SUB_REQUEST constant
TestMultipleHttpKernel::$backendRequest protected property
TestMultipleHttpKernel::$bodies protected property
TestMultipleHttpKernel::$call protected property
TestMultipleHttpKernel::$catch protected property
TestMultipleHttpKernel::$headers protected property
TestMultipleHttpKernel::$statuses protected property
TestMultipleHttpKernel::callController public function
TestMultipleHttpKernel::getArguments public function Returns the arguments to pass to the controller. Overrides ControllerResolverInterface::getArguments
TestMultipleHttpKernel::getBackendRequest public function
TestMultipleHttpKernel::getController public function Returns the Controller instance associated with a Request. Overrides ControllerResolverInterface::getController
TestMultipleHttpKernel::handle public function @api Overrides HttpKernel::handle
TestMultipleHttpKernel::hasBeenCalled public function
TestMultipleHttpKernel::reset public function
TestMultipleHttpKernel::__construct public function Constructor Overrides HttpKernel::__construct