Skip to content

Commit

Permalink
Fix error template in WhoopsRenderer
Browse files Browse the repository at this point in the history
Ref : #886
  • Loading branch information
lcharette committed Sep 5, 2018
1 parent 996f82a commit e8a6d8a
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Prevent setup to run again if already configured when using `bake`
- Fix `Unique::getPaginatedQuery` to call to `addSelect` instead of `select` during the pre-paginated query
- Updated Spanish Translation (Thanks @silvioq !)
- Fix error template in WhoopsRenderer (#885; Thanks @silvioq !)

## v4.1.18
- Bakery setup wizard for SMTP config + separate SMTP setup in it's own command (https://github.com/userfrosting/UserFrosting/issues/874)
Expand Down
1 change: 1 addition & 0 deletions app/sprinkles/core/src/Error/Renderer/WhoopsRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ public function render()
"has_frames" => !!count($frames),
"handler" => $this,
"handlers" => [$this],
"prettify" => true,

"active_frames_tab" => count($frames) && $frames->offsetGet(0)->isApplication() ? 'application' : 'all',
"has_frames_tabs" => $this->getApplicationPaths(),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

namespace UserFrosting\Tests\Integration\Error\Renderer;

use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Message\ResponseInterface;
use UserFrosting\Sprinkle\Core\Error\Renderer\WhoopsRenderer;
use UserFrosting\Tests\TestCase;

class WhoopsRendererTest extends TestCase
{
public function testRenderWhoopsPage()
{
$request = $this->getMockBuilder(ServerRequestInterface::class)
->disableOriginalConstructor()
->getMock();

$response = $this->getMockBuilder(ResponseInterface::class)
->disableOriginalConstructor()
->getMock();

$exception = new \RuntimeException('This is my exception');

$whoopsRenderer = new WhoopsRenderer($request, $response, $exception, true);

// Avoid handle cli SAPI
$whoopsRenderer->handleUnconditionally(true);

$renderBody = $whoopsRenderer->render();
$this->assertTrue(!!preg_match('/RuntimeException: This is my exception in file /', $renderBody));
$this->assertTrue(!!preg_match('/<span>This is my exception<\/span>/', $renderBody));
}
}

0 comments on commit e8a6d8a

Please sign in to comment.