10000 minor #24666 [WebProfilerBundle] add missing tests (mhujer) · symfony/symfony@efb4891 · GitHub
[go: up one dir, main page]

Skip to content

Commit efb4891

Browse files
committed
minor #24666 [WebProfilerBundle] add missing tests (mhujer)
This PR was squashed before being merged into the 2.7 branch (closes #24666). Discussion ---------- [WebProfilerBundle] add missing tests | Q | A | ------------- | --- | Branch? | 2.7 | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | none | License | MIT This PR fixes one test in WebDebugToolbarListenerTest and adds one that was missing (more detailed description is available in the commits description) Commits ------- 363d3a8 [WebProfilerBundle] add missing tests
2 parents 83c3282 + 363d3a8 commit efb4891

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

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

Lines changed: 17 additions & 0 deletions
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)
0