class TestMultipleHttpKernel in Zircon Profile 8.0
Same name and namespace in other branches
- 8 vendor/symfony/http-kernel/Tests/HttpCache/TestMultipleHttpKernel.php \Symfony\Component\HttpKernel\Tests\HttpCache\TestMultipleHttpKernel
Hierarchy
- class \Symfony\Component\HttpKernel\HttpKernel implements HttpKernelInterface, TerminableInterface
- class \Symfony\Component\HttpKernel\Tests\HttpCache\TestMultipleHttpKernel implements ControllerResolverInterface
Expanded class hierarchy of TestMultipleHttpKernel
File
- vendor/
symfony/ http-kernel/ Tests/ HttpCache/ TestMultipleHttpKernel.php, line 21
Namespace
Symfony\Component\HttpKernel\Tests\HttpCacheView source
class TestMultipleHttpKernel extends HttpKernel implements ControllerResolverInterface {
protected $bodies = array();
protected $statuses = array();
protected $headers = array();
protected $call = false;
protected $backendRequest;
public function __construct($responses) {
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;
}
}