"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "public_html/lists/base/vendor/symfony/symfony/src/Symfony/Component/Debug/Tests/ExceptionHandlerTest.php" between
phplist-3.4.5.tgz and phplist-3.4.6.tgz

About: phpList is a one-way email announcement delivery system for newsletters, publicity lists, notifications, and many other uses (requires PHP and MySQL).

ExceptionHandlerTest.php  (phplist-3.4.5.tgz):ExceptionHandlerTest.php  (phplist-3.4.6.tgz)
skipping to change at line 42 skipping to change at line 42
} }
public function testDebug() public function testDebug()
{ {
$handler = new ExceptionHandler(false); $handler = new ExceptionHandler(false);
ob_start(); ob_start();
$handler->sendPhpResponse(new \RuntimeException('Foo')); $handler->sendPhpResponse(new \RuntimeException('Foo'));
$response = ob_get_clean(); $response = ob_get_clean();
$this->assertContains('Whoops, looks like something went wrong.', $respo $this->assertStringContainsString('Whoops, looks like something went wro
nse); ng.', $response);
$this->assertNotContains('<div class="trace trace-as-html">', $response) $this->assertStringNotContainsString('<div class="trace trace-as-html">'
; , $response);
$handler = new ExceptionHandler(true); $handler = new ExceptionHandler(true);
ob_start(); ob_start();
$handler->sendPhpResponse(new \RuntimeException('Foo')); $handler->sendPhpResponse(new \RuntimeException('Foo'));
$response = ob_get_clean(); $response = ob_get_clean();
$this->assertContains('Whoops, looks like something went wrong.', $respo $this->assertStringContainsString('Whoops, looks like something went wro
nse); ng.', $response);
$this->assertContains('<div class="trace trace-as-html">', $response); $this->assertStringContainsString('<div class="trace trace-as-html">', $
response);
} }
public function testStatusCode() public function testStatusCode()
{ {
$handler = new ExceptionHandler(false, 'iso8859-1'); $handler = new ExceptionHandler(false, 'iso8859-1');
ob_start(); ob_start();
$handler->sendPhpResponse(new NotFoundHttpException('Foo')); $handler->sendPhpResponse(new NotFoundHttpException('Foo'));
$response = ob_get_clean(); $response = ob_get_clean();
$this->assertContains('Sorry, the page you are looking for could not be found.', $response); $this->assertStringContainsString('Sorry, the page you are looking for c ould not be found.', $response);
$expectedHeaders = [ $expectedHeaders = [
['HTTP/1.0 404', true, null], ['HTTP/1.0 404', true, null],
['Content-Type: text/html; charset=iso8859-1', true, null], ['Content-Type: text/html; charset=iso8859-1', true, null],
]; ];
$this->assertSame($expectedHeaders, testHeader()); $this->assertSame($expectedHeaders, testHeader());
} }
public function testHeaders() public function testHeaders()
skipping to change at line 119 skipping to change at line 119
public function testHandleWithACustomHandlerThatOutputsSomething() public function testHandleWithACustomHandlerThatOutputsSomething()
{ {
$handler = new ExceptionHandler(true); $handler = new ExceptionHandler(true);
ob_start(); ob_start();
$handler->setHandler(function () { $handler->setHandler(function () {
echo 'ccc'; echo 'ccc';
}); });
$handler->handle(new \Exception()); $handler->handle(new \Exception());
ob_end_flush(); // Necessary because of this PHP bug : https://bugs.php. net/bug.php?id=76563 ob_end_flush(); // Necessary because of this PHP bug : https://bugs.php. net/76563
$this->assertSame('ccc', ob_get_clean()); $this->assertSame('ccc', ob_get_clean());
} }
public function testHandleWithACustomHandlerThatOutputsNothing() public function testHandleWithACustomHandlerThatOutputsNothing()
{ {
$handler = new ExceptionHandler(true); $handler = new ExceptionHandler(true);
$handler->setHandler(function () {}); $handler->setHandler(function () {});
$handler->handle(new \Exception('ccc')); $handler->handle(new \Exception('ccc'));
skipping to change at line 160 skipping to change at line 160
$this->fail('OutOfMemoryException should bypass the handler'); $this->fail('OutOfMemoryException should bypass the handler');
}); });
$handler->handle(new OutOfMemoryException('foo', 0, E_ERROR, __FILE__, _ _LINE__)); $handler->handle(new OutOfMemoryException('foo', 0, E_ERROR, __FILE__, _ _LINE__));
$this->assertThatTheExceptionWasOutput(ob_get_clean(), OutOfMemoryExcept ion::class, 'OutOfMemoryException', 'foo'); $this->assertThatTheExceptionWasOutput(ob_get_clean(), OutOfMemoryExcept ion::class, 'OutOfMemoryException', 'foo');
} }
private function assertThatTheExceptionWasOutput($content, $expectedClass, $ expectedTitle, $expectedMessage) private function assertThatTheExceptionWasOutput($content, $expectedClass, $ expectedTitle, $expectedMessage)
{ {
$this->assertContains(sprintf('<span class="exception_title"><abbr title $this->assertStringContainsString(sprintf('<span class="exception_title"
="%s">%s</abbr></span>', $expectedClass, $expectedTitle), $content); ><abbr title="%s">%s</abbr></span>', $expectedClass, $expectedTitle), $content);
$this->assertContains(sprintf('<p class="break-long-words trace-message" $this->assertStringContainsString(sprintf('<p class="break-long-words tr
>%s</p>', $expectedMessage), $content); ace-message">%s</p>', $expectedMessage), $content);
} }
} }
 End of changes. 5 change blocks. 
13 lines changed or deleted 14 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)