[WebProfilerBundle] add missing tests

This commit is contained in:
Martin Hujer 2017-10-22 20:54:24 +02:00 committed by Fabien Potencier
parent 0f9c6e6682
commit 363d3a8cf2
1 changed files with 17 additions and 0 deletions

View File

@ -83,12 +83,29 @@ class WebDebugToolbarListenerTest extends TestCase
$this->assertEquals("<html><head></head><body>\nWDT\n</body></html>", $response->getContent());
}
/**
* @depends testToolbarIsInjected
*/
public function testToolbarIsNotInjectedOnNonHtmlContentType()
{
$response = new Response('<html><head></head><body></body></html>');
$response->headers->set('X-Debug-Token', 'xxxxxxxx');
$response->headers->set('Content-Type', 'text/xml');
$event = new FilterResponseEvent($this->getKernelMock(), $this->getRequestMock(), HttpKernelInterface::MASTER_REQUEST, $response);
$listener = new WebDebugToolbarListener($this->getTwigMock());
$listener->onKernelResponse($event);
$this->assertEquals('<html><head></head><body></body></html>', $response->getContent());
}
/**
* @depends testToolbarIsInjected
*/
public function testToolbarIsNotInjectedOnContentDispositionAttachment()
{
$response = new Response('<html><head></head><body></body></html>');
$response->headers->set('X-Debug-Token', 'xxxxxxxx');
$response->headers->set('Content-Disposition', 'attachment; filename=test.html');
$event = new FilterResponseEvent($this->getKernelMock(), $this->getRequestMock(false, 'html'), HttpKernelInterface::MASTER_REQUEST, $response);