Skip to content

Commit e8a6d8a

Browse files
committed
Fix error template in WhoopsRenderer
Ref : #886
1 parent 996f82a commit e8a6d8a

3 files changed

Lines changed: 35 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
99
- Prevent setup to run again if already configured when using `bake`
1010
- Fix `Unique::getPaginatedQuery` to call to `addSelect` instead of `select` during the pre-paginated query
1111
- Updated Spanish Translation (Thanks @silvioq !)
12+
- Fix error template in WhoopsRenderer (#885; Thanks @silvioq !)
1213

1314
## v4.1.18
1415
- Bakery setup wizard for SMTP config + separate SMTP setup in it's own command (https://github.com/userfrosting/UserFrosting/issues/874)

app/sprinkles/core/src/Error/Renderer/WhoopsRenderer.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,7 @@ public function render()
250250
"has_frames" => !!count($frames),
251251
"handler" => $this,
252252
"handlers" => [$this],
253+
"prettify" => true,
253254

254255
"active_frames_tab" => count($frames) && $frames->offsetGet(0)->isApplication() ? 'application' : 'all',
255256
"has_frames_tabs" => $this->getApplicationPaths(),
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php
2+
3+
namespace UserFrosting\Tests\Integration\Error\Renderer;
4+
5+
use Psr\Http\Message\ServerRequestInterface;
6+
use Psr\Http\Message\ResponseInterface;
7+
use UserFrosting\Sprinkle\Core\Error\Renderer\WhoopsRenderer;
8+
use UserFrosting\Tests\TestCase;
9+
10+
class WhoopsRendererTest extends TestCase
11+
{
12+
public function testRenderWhoopsPage()
13+
{
14+
$request = $this->getMockBuilder(ServerRequestInterface::class)
15+
->disableOriginalConstructor()
16+
->getMock();
17+
18+
$response = $this->getMockBuilder(ResponseInterface::class)
19+
->disableOriginalConstructor()
20+
->getMock();
21+
22+
$exception = new \RuntimeException('This is my exception');
23+
24+
$whoopsRenderer = new WhoopsRenderer($request, $response, $exception, true);
25+
26+
// Avoid handle cli SAPI
27+
$whoopsRenderer->handleUnconditionally(true);
28+
29+
$renderBody = $whoopsRenderer->render();
30+
$this->assertTrue(!!preg_match('/RuntimeException: This is my exception in file /', $renderBody));
31+
$this->assertTrue(!!preg_match('/<span>This is my exception<\/span>/', $renderBody));
32+
}
33+
}

0 commit comments

Comments
 (0)