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 4aa5ef6 commit 6f898a5
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions tests/Symfony/Tests/Component/HttpKernel/Cache/EsiTest.php
Expand Up @@ -89,7 +89,7 @@ public function testProcessDoesNothingIfContentTypeIsNotHtml()
$response->headers->set('Content-Type', 'text/plain');
$esi->process($request, $response);

$this->assertEquals(array('content-type' => array('text/plain')), $response->headers->all());
$this->assertFalse($response->headers->has('x-body-eval'));
}

public function testProcess()
Expand All @@ -101,7 +101,7 @@ public function testProcess()
$esi->process($request, $response);

$this->assertEquals('foo <?php echo $this->esi->handle($this, \'...\', \'alt\', true) ?>'."\n", $response->getContent());
$this->assertEquals(array('x-body-eval' => array('ESI')), $response->headers->all());
$this->assertEquals('ESI', $response->headers->get('x-body-eval'));

$response = new Response('foo <esi:include src="..." />');
$esi->process($request, $response);
Expand Down Expand Up @@ -129,15 +129,17 @@ public function testProcessRemoveSurrogateControlHeader()
$response = new Response('foo <esi:include src="..." />');
$response->headers->set('Surrogate-Control', 'content="ESI/1.0"');
$esi->process($request, $response);
$this->assertEquals(array('x-body-eval' => array('ESI')), $response->headers->all());
$this->assertEquals('ESI', $response->headers->get('x-body-eval'));

$response->headers->set('Surrogate-Control', 'no-store, content="ESI/1.0"');
$esi->process($request, $response);
$this->assertEquals(array('surrogate-control' => array('no-store'), 'x-body-eval' => array('ESI')), $response->headers->all());
$this->assertEquals('ESI', $response->headers->get('x-body-eval'));
$this->assertEquals('no-store', $response->headers->get('surrogate-control'));

$response->headers->set('Surrogate-Control', 'content="ESI/1.0", no-store');
$esi->process($request, $response);
$this->assertEquals(array('surrogate-control' => array('no-store'), 'x-body-eval' => array('ESI')), $response->headers->all());
$this->assertEquals('ESI', $response->headers->get('x-body-eval'));
$this->assertEquals('no-store', $response->headers->get('surrogate-control'));
}

public function testHandle()
Expand Down

0 comments on commit 6f898a5

Please sign in to comment.