Skip to content

Commit

Permalink
[HttpKernel] made some tests more robust
Browse files Browse the repository at this point in the history
  • Loading branch information
fabpot committed Nov 13, 2010
1 parent 98f3ac6 commit 4aa5ef6
Showing 1 changed file with 4 additions and 4 deletions.
Expand Up @@ -25,7 +25,7 @@ public function testFilterDoesNothingForSubRequests()
$event = new Event(null, 'core.response', array('request_type' => HttpKernelInterface::SUB_REQUEST));
$this->getDispatcher()->filter($event, $response = new Response('foo'));

$this->assertEquals(array(), $response->headers->all());
$this->assertEquals('', $response->headers->get('content-type'));
}

public function testFilterDoesNothingIfContentTypeIsSet()
Expand All @@ -35,15 +35,15 @@ public function testFilterDoesNothingIfContentTypeIsSet()
$response->headers->set('Content-Type', 'text/plain');
$this->getDispatcher()->filter($event, $response);

$this->assertEquals(array('content-type' => array('text/plain')), $response->headers->all());
$this->assertEquals('text/plain', $response->headers->get('content-type'));
}

public function testFilterDoesNothingIfRequestFormatIsNotDefined()
{
$event = new Event(null, 'core.response', array('request_type' => HttpKernelInterface::MASTER_REQUEST, 'request' => Request::create('/')));
$this->getDispatcher()->filter($event, $response = new Response('foo'));

$this->assertEquals(array(), $response->headers->all());
$this->assertEquals('', $response->headers->get('content-type'));
}

public function testFilterSetContentType()
Expand All @@ -53,7 +53,7 @@ public function testFilterSetContentType()
$event = new Event(null, 'core.response', array('request_type' => HttpKernelInterface::MASTER_REQUEST, 'request' => $request));
$this->getDispatcher()->filter($event, $response = new Response('foo'));

$this->assertEquals(array('content-type' => array('application/json')), $response->headers->all());
$this->assertEquals('application/json', $response->headers->get('content-type'));
}

protected function getDispatcher()
Expand Down

0 comments on commit 4aa5ef6

Please sign in to comment.