You are here

public function RequestDataCollectorTest::testCollect in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/symfony/http-kernel/Tests/DataCollector/RequestDataCollectorTest.php \Symfony\Component\HttpKernel\Tests\DataCollector\RequestDataCollectorTest::testCollect()

File

vendor/symfony/http-kernel/Tests/DataCollector/RequestDataCollectorTest.php, line 25

Class

RequestDataCollectorTest

Namespace

Symfony\Component\HttpKernel\Tests\DataCollector

Code

public function testCollect() {
  $c = new RequestDataCollector();
  $c
    ->collect($this
    ->createRequest(), $this
    ->createResponse());
  $attributes = $c
    ->getRequestAttributes();
  $this
    ->assertSame('request', $c
    ->getName());
  $this
    ->assertInstanceOf('Symfony\\Component\\HttpFoundation\\HeaderBag', $c
    ->getRequestHeaders());
  $this
    ->assertInstanceOf('Symfony\\Component\\HttpFoundation\\ParameterBag', $c
    ->getRequestServer());
  $this
    ->assertInstanceOf('Symfony\\Component\\HttpFoundation\\ParameterBag', $c
    ->getRequestCookies());
  $this
    ->assertInstanceOf('Symfony\\Component\\HttpFoundation\\ParameterBag', $attributes);
  $this
    ->assertInstanceOf('Symfony\\Component\\HttpFoundation\\ParameterBag', $c
    ->getRequestRequest());
  $this
    ->assertInstanceOf('Symfony\\Component\\HttpFoundation\\ParameterBag', $c
    ->getRequestQuery());
  $this
    ->assertSame('html', $c
    ->getFormat());
  $this
    ->assertSame('foobar', $c
    ->getRoute());
  $this
    ->assertSame(array(
    'name' => 'foo',
  ), $c
    ->getRouteParams());
  $this
    ->assertSame(array(), $c
    ->getSessionAttributes());
  $this
    ->assertSame('en', $c
    ->getLocale());
  $this
    ->assertRegExp('/Resource\\(stream#\\d+\\)/', $attributes
    ->get('resource'));
  $this
    ->assertSame('Object(stdClass)', $attributes
    ->get('object'));
  $this
    ->assertInstanceOf('Symfony\\Component\\HttpFoundation\\HeaderBag', $c
    ->getResponseHeaders());
  $this
    ->assertSame('OK', $c
    ->getStatusText());
  $this
    ->assertSame(200, $c
    ->getStatusCode());
  $this
    ->assertSame('application/json', $c
    ->getContentType());
}