<?php use Illuminate\Support\Facades\Route; use Illuminate\Support\Str; beforeEach(function () { config()->set('app.debug', true); Route::get('will-fail', function () { throw new Exception('My exception'); }); }); test('when requesting html it will respond with html', function () { $response = $this ->get('will-fail') ->baseResponse; expect($response->headers->get('Content-Type'))->toStartWith('text/html'); expect(Str::contains($response->getContent(), 'html'))->toBeTrue(); }); test('when requesting json it will respond with json', function () { /** @var \Illuminate\Http\Response $response */ $response = $this->getJson('will-fail'); expect($response->headers->get('Content-Type'))->toStartWith('application/json'); expect(json_decode($response->getContent(), true)['message'])->toEqual('My exception'); });
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
Commands | Folder | 0755 |
|
|
Context | Folder | 0755 |
|
|
ContextProviders | Folder | 0755 |
|
|
Exceptions | Folder | 0755 |
|
|
FlareMiddleware | Folder | 0755 |
|
|
Http | Folder | 0755 |
|
|
LogRecorder | Folder | 0755 |
|
|
Mocks | Folder | 0755 |
|
|
QueryRecorder | Folder | 0755 |
|
|
Recorders | Folder | 0755 |
|
|
Solutions | Folder | 0755 |
|
|
Support | Folder | 0755 |
|
|
TestClasses | Folder | 0755 |
|
|
Views | Folder | 0755 |
|
|
stubs | Folder | 0755 |
|
|
ErrorPageViewModelTest.php | File | 665 B | 0644 |
|
ExceptionSolutionTest.php | File | 3.07 KB | 0644 |
|
FlareTest.php | File | 956 B | 0644 |
|
HelpersTest.php | File | 103 B | 0644 |
|
IgnitionConfigTest.php | File | 1.39 KB | 0644 |
|
LogTest.php | File | 4.29 KB | 0644 |
|
Pest.php | File | 92 B | 0644 |
|
RenderIgnitionPageTest.php | File | 915 B | 0644 |
|
TestCase.php | File | 1.75 KB | 0644 |
|