Skip to content

Commit

Permalink
Making debug = false by default and cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
yceruto committed Jul 22, 2019
1 parent 7dfc97b commit b28986f
Show file tree
Hide file tree
Showing 9 changed files with 8 additions and 11 deletions.
Expand Up @@ -31,7 +31,6 @@
<service id="error_renderer.renderer.txt" class="Symfony\Component\ErrorRenderer\ErrorRenderer\TxtErrorRenderer">
<tag name="error_renderer.renderer" />
<argument>%kernel.debug%</argument>
<argument>%kernel.charset%</argument>
</service>
</services>
</container>
Expand Up @@ -33,7 +33,7 @@ class HtmlErrorRenderer implements ErrorRendererInterface
private $charset;
private $fileLinkFormat;

public function __construct(bool $debug = true, string $charset = null, $fileLinkFormat = null)
public function __construct(bool $debug = false, string $charset = null, $fileLinkFormat = null)
{
$this->debug = $debug;
$this->charset = $charset ?: (ini_get('default_charset') ?: 'UTF-8');
Expand Down
Expand Up @@ -20,7 +20,7 @@ class JsonErrorRenderer implements ErrorRendererInterface
{
private $debug;

public function __construct(bool $debug = true)
public function __construct(bool $debug = false)
{
$this->debug = $debug;
}
Expand Down
Expand Up @@ -19,12 +19,10 @@
class TxtErrorRenderer implements ErrorRendererInterface
{
private $debug;
private $charset;

public function __construct(bool $debug = true, string $charset = null)
public function __construct(bool $debug = false)
{
$this->debug = $debug;
$this->charset = $charset ?: (ini_get('default_charset') ?: 'UTF-8');
}

/**
Expand Down
Expand Up @@ -21,7 +21,7 @@ class XmlErrorRenderer implements ErrorRendererInterface
private $debug;
private $charset;

public function __construct(bool $debug = true, string $charset = null)
public function __construct(bool $debug = false, string $charset = null)
{
$this->debug = $debug;
$this->charset = $charset ?: (ini_get('default_charset') ?: 'UTF-8');
Expand Down
Expand Up @@ -22,6 +22,6 @@ public function testRender()
$exception = FlattenException::createFromThrowable(new \RuntimeException('Foo'));
$expected = '<!DOCTYPE html>%A<html>%A<head>%A<title>Internal Server Error</title>%A<h1 class="break-long-words exception-message">Foo</h1>%A<abbr title="RuntimeException">RuntimeException</abbr>%A';

$this->assertStringMatchesFormat($expected, (new HtmlErrorRenderer())->render($exception));
$this->assertStringMatchesFormat($expected, (new HtmlErrorRenderer(true))->render($exception));
}
}
Expand Up @@ -32,6 +32,6 @@ public function testRender()
"trace":
JSON;

$this->assertStringStartsWith($expected, (new JsonErrorRenderer())->render($exception));
$this->assertStringStartsWith($expected, (new JsonErrorRenderer(true))->render($exception));
}
}
Expand Up @@ -22,6 +22,6 @@ public function testRender()
$exception = FlattenException::createFromThrowable(new \RuntimeException('Foo'));
$expected = '[title] Internal Server Error%A[status] 500%A[detail] Foo%A[1] RuntimeException: Foo%A';

$this->assertStringMatchesFormat($expected, (new TxtErrorRenderer())->render($exception));
$this->assertStringMatchesFormat($expected, (new TxtErrorRenderer(true))->render($exception));
}
}
Expand Up @@ -22,6 +22,6 @@ public function testRender()
$exception = FlattenException::createFromThrowable(new \RuntimeException('Foo'));
$expected = '<?xml version="1.0" encoding="UTF-8" ?>%A<problem xmlns="urn:ietf:rfc:7807">%A<title>Internal Server Error</title>%A<status>500</status>%A<detail>Foo</detail>%A';

$this->assertStringMatchesFormat($expected, (new XmlErrorRenderer())->render($exception));
$this->assertStringMatchesFormat($expected, (new XmlErrorRenderer(true))->render($exception));
}
}

0 comments on commit b28986f

Please sign in to comment.