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
-------
363d3a8cf2
[WebProfilerBundle] add missing tests
This commit is contained in:
commit
efb4891981
@ -83,12 +83,29 @@ class WebDebugToolbarListenerTest extends TestCase
|
|||||||
$this->assertEquals("<html><head></head><body>\nWDT\n</body></html>", $response->getContent());
|
$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
|
* @depends testToolbarIsInjected
|
||||||
*/
|
*/
|
||||||
public function testToolbarIsNotInjectedOnContentDispositionAttachment()
|
public function testToolbarIsNotInjectedOnContentDispositionAttachment()
|
||||||
{
|
{
|
||||||
$response = new Response('<html><head></head><body></body></html>');
|
$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');
|
$response->headers->set('Content-Disposition', 'attachment; filename=test.html');
|
||||||
$event = new FilterResponseEvent($this->getKernelMock(), $this->getRequestMock(false, 'html'), HttpKernelInterface::MASTER_REQUEST, $response);
|
$event = new FilterResponseEvent($this->getKernelMock(), $this->getRequestMock(false, 'html'), HttpKernelInterface::MASTER_REQUEST, $response);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user