Exemplo n.º 1
0
 public function testDoRequest()
 {
     $client = new Client(new TestHttpKernel());
     $client->request('GET', '/');
     $this->assertEquals('Request: /', $client->getResponse()->getContent(), '->doRequest() uses the request handler to make the request');
     $client->request('GET', 'http://www.example.com/');
     $this->assertEquals('Request: /', $client->getResponse()->getContent(), '->doRequest() uses the request handler to make the request');
     $this->assertEquals('www.example.com', $client->getRequest()->getHost(), '->doRequest() uses the request handler to make the request');
 }
Exemplo n.º 2
0
 /**
  * Constructor.
  *
  * @param Symfony\Components\HttpKernel\HttpKernelInterface $kernel    A Kernel instance
  * @param array                                             $server    The server parameters (equivalent of $_SERVER)
  * @param Symfony\Components\BrowserKit\History             $history   A History instance to store the browser history
  * @param Symfony\Components\BrowserKit\CookieJar           $cookieJar A CookieJar instance to store the cookies
  */
 public function __construct(HttpKernelInterface $kernel, array $server = array(), History $history = null, CookieJar $cookieJar = null)
 {
     parent::__construct($kernel, $server, $history, $cookieJar);
     $this->container = $kernel->getContainer();
 }