/** * @test */ public function echoExceptionWebEscapesExceptionTitle() { $title = '<b>b</b><script>alert(1);</script>'; /** @var $exception \Exception|\PHPUnit_Framework_MockObject_MockObject */ $exception = $this->getMock('Exception', array('getTitle'), array('some message')); $exception->expects($this->any())->method('getTitle')->will($this->returnValue($title)); ob_start(); $this->subject->echoExceptionWeb($exception); $output = ob_get_contents(); ob_end_clean(); $this->assertContains(htmlspecialchars($title), $output); $this->assertNotContains($title, $output); }
/** * Formats and echoes the exception for the command line * * @param \Exception $exception The exception object * @return void */ public function echoExceptionCLI($exception) { $this->sendToSlack($exception); parent::echoExceptionWeb($exception); }