Skip to content

Commit 363d3a8

Browse files
mhujerfabpot
authored andcommitted
[WebProfilerBundle] add missing tests
1 parent 0f9c6e6 commit 363d3a8

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/Symfony/Bundle/WebProfilerBundle/Tests/EventListener/WebDebugToolbarListenerTest.php

+17
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,29 @@ public function testToolbarIsInjected()
8383
$this->assertEquals("<html><head></head><body>\nWDT\n</body></html>", $response->getContent());
8484
}
8585

86+
/**
87+
* @depends testToolbarIsInjected
88+
*/
89+
public function testToolbarIsNotInjectedOnNonHtmlContentType()
90+
{
91+
$response = new Response('<html><head></head><body></body></html>');
92+
$response->headers->set('X-Debug-Token', 'xxxxxxxx');
93+
$response->headers->set('Content-Type', 'text/xml');
94+
$event = new FilterResponseEvent($this->getKernelMock(), $this->getRequestMock(), HttpKernelInterface::MASTER_REQUEST, $response);
95+
96+
$listener = new WebDebugToolbarListener($this->getTwigMock());
97+
$listener->onKernelResponse($event);
98+
99+
$this->assertEquals('<html><head></head><body></body></html>', $response->getContent());
100+
}
101+
86102
/**
87103
* @depends testToolbarIsInjected
88104
*/
89105
public function testToolbarIsNotInjectedOnContentDispositionAttachment()
90106
{
91107
$response = new Response('<html><head></head><body></body></html>');
108+
$response->headers->set('X-Debug-Token', 'xxxxxxxx');
92109
$response->headers->set('Content-Disposition', 'attachment; filename=test.html');
93110
$event = new FilterResponseEvent($this->getKernelMock(), $this->getRequestMock(false, 'html'), HttpKernelInterface::MASTER_REQUEST, $response);
94111

0 commit comments

Comments
 (0)