This repository was archived by the owner on Feb 17, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +29
-4
lines changed Expand file tree Collapse file tree 3 files changed +29
-4
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,8 @@ previously in the `has-many` adapter).
12
12
- Moved the ` FindsManyResources ` trait from the ` Store ` namespace to ` Adapter\Concerns ` .
13
13
- The ` hydrateRelationships ` method on the ` AbstractResourceAdapter ` is no longer abstract as it now
14
14
contains the implementation that was previously on the Eloquent adapter.
15
+ - The test exception handler has been moved from the dummy app to the ` Testing ` namespace. This means it
16
+ can now be used when testing JSON API packages.
15
17
16
18
## [ 1.0.0-alpha.2] - 2018-05-06
17
19
Original file line number Diff line number Diff line change 15
15
* limitations under the License.
16
16
*/
17
17
18
- namespace DummyApp \ Exceptions ;
18
+ namespace CloudCreativity \ LaravelJsonApi \ Testing ;
19
19
20
20
use CloudCreativity \LaravelJsonApi \Exceptions \HandlesErrors ;
21
21
use Exception ;
22
22
use Illuminate \Auth \Access \AuthorizationException ;
23
23
use Illuminate \Auth \AuthenticationException ;
24
24
use Neomerx \JsonApi \Exceptions \JsonApiException ;
25
- use Orchestra \ Testbench \Exceptions \Handler as BaseHandler ;
25
+ use Illuminate \ Foundation \Exceptions \Handler as ExceptionHandler ;
26
26
27
- class Handler extends BaseHandler
27
+ /**
28
+ * Class TestExceptionHandler
29
+ *
30
+ * This exception handler is intended for testing JSON API packages
31
+ * using the `orchestra/testbench` package. It ensures that JSON
32
+ * API exceptions are rendered and if the handler receives any other
33
+ * exceptions, they are re-thrown so that they appear in PHP Unit.
34
+ *
35
+ * Usage in a testbench test case is as follows:
36
+ *
37
+ * ```php
38
+ * protected function resolveApplicationExceptionHandler($app)
39
+ * {
40
+ * $app->singleton(
41
+ * \Illuminate\Contracts\Debug\ExceptionHandler::class,
42
+ * \CloudCreativity\LaravelJsonApi\Testing\TestExceptionHandler::class
43
+ * );
44
+ * }
45
+ * ```
46
+ *
47
+ * @package CloudCreativity\LaravelJsonApi
48
+ */
49
+ class TestExceptionHandler extends ExceptionHandler
28
50
{
29
51
30
52
use HandlesErrors;
Original file line number Diff line number Diff line change 21
21
use CloudCreativity \LaravelJsonApi \Facades \JsonApi ;
22
22
use CloudCreativity \LaravelJsonApi \ServiceProvider ;
23
23
use CloudCreativity \LaravelJsonApi \Testing \MakesJsonApiRequests ;
24
+ use CloudCreativity \LaravelJsonApi \Testing \TestExceptionHandler ;
24
25
use DummyApp ;
25
26
use DummyApp \User ;
26
27
use DummyPackage ;
@@ -88,7 +89,7 @@ protected function getPackageAliases($app)
88
89
*/
89
90
protected function resolveApplicationExceptionHandler ($ app )
90
91
{
91
- $ app ->singleton (ExceptionHandler::class, DummyApp \ Exceptions \Handler ::class);
92
+ $ app ->singleton (ExceptionHandler::class, TestExceptionHandler ::class);
92
93
}
93
94
94
95
/**
You can’t perform that action at this time.
0 commit comments