-
Notifications
You must be signed in to change notification settings - Fork 11.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[11.x] Avoid using Laravel new error page if
app.debug
changes to `…
…true` at runtime (#51705) * [11.x] Avoid using Laravel new renderer if `app.debug` changes to `true` at runtime Signed-off-by: Mior Muhammad Zaki <[email protected]> * wip Signed-off-by: Mior Muhammad Zaki <[email protected]> --------- Signed-off-by: Mior Muhammad Zaki <[email protected]>
- Loading branch information
Showing
2 changed files
with
45 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
|
||
namespace Illuminate\Tests\Integration\Foundation\Exceptions; | ||
|
||
use Illuminate\Foundation\Exceptions\Renderer\Renderer; | ||
use Orchestra\Testbench\Attributes\WithConfig; | ||
use Orchestra\Testbench\TestCase; | ||
use RuntimeException; | ||
|
||
class RendererTest extends TestCase | ||
{ | ||
protected function defineRoutes($router) | ||
{ | ||
$router->get('failed', fn () => throw new RuntimeException('Bad route!')); | ||
} | ||
|
||
#[WithConfig('app.debug', true)] | ||
public function testItCanRenderExceptionPage() | ||
{ | ||
$this->assertTrue($this->app->bound(Renderer::class)); | ||
|
||
$this->get('/failed') | ||
->assertInternalServerError() | ||
->assertSee('RuntimeException') | ||
->assertSee('Bad route!'); | ||
} | ||
|
||
#[WithConfig('app.debug', false)] | ||
public function testItCanRenderExceptionPageUsingSymfonyIfRendererIsNotDefined() | ||
{ | ||
config(['app.debug' => true]); | ||
|
||
$this->assertFalse($this->app->bound(Renderer::class)); | ||
|
||
$this->get('/failed') | ||
->assertInternalServerError() | ||
->assertSee('RuntimeException') | ||
->assertSee('Bad route!'); | ||
} | ||
} |