-
Notifications
You must be signed in to change notification settings - Fork 46
Closed
Description
When testing my package with Orchestra Testbench, if the getPackageProviders method in TestCase.php specifies the service provider of my package:
protected function getPackageProviders($app): array
{
return [
MyPackageServiceProvider::class
];
}The following error appears:
Illuminate\Contracts\Container\BindingResolutionException: Target [LaravelJsonApi\Contracts\Server\Repository] is not instantiable while building [LaravelJsonApi\Laravel\Routing\Registrar].
C:\OSPanel\domains\localhost\packages\vitkuz573\my-package\vendor\laravel\framework\src\Illuminate\Container\Container.php:1087
C:\OSPanel\domains\localhost\packages\vitkuz573\my-package\vendor\laravel\framework\src\Illuminate\Container\Container.php:884
C:\OSPanel\domains\localhost\packages\vitkuz573\my-package\vendor\laravel\framework\src\Illuminate\Container\Container.php:756
C:\OSPanel\domains\localhost\packages\vitkuz573\my-package\vendor\laravel\framework\src\Illuminate\Foundation\Application.php:855
C:\OSPanel\domains\localhost\packages\vitkuz573\my-package\vendor\laravel\framework\src\Illuminate\Container\Container.php:692
C:\OSPanel\domains\localhost\packages\vitkuz573\my-package\vendor\laravel\framework\src\Illuminate\Foundation\Application.php:840
C:\OSPanel\domains\localhost\packages\vitkuz573\my-package\vendor\laravel\framework\src\Illuminate\Container\Container.php:1025
C:\OSPanel\domains\localhost\packages\vitkuz573\my-package\vendor\laravel\framework\src\Illuminate\Container\Container.php:945
C:\OSPanel\domains\localhost\packages\vitkuz573\my-package\vendor\laravel\framework\src\Illuminate\Container\Container.php:906
C:\OSPanel\domains\localhost\packages\vitkuz573\my-package\vendor\laravel\framework\src\Illuminate\Container\Container.php:756
C:\OSPanel\domains\localhost\packages\vitkuz573\my-package\vendor\laravel\framework\src\Illuminate\Foundation\Application.php:855
C:\OSPanel\domains\localhost\packages\vitkuz573\my-package\vendor\laravel\framework\src\Illuminate\Container\Container.php:692
C:\OSPanel\domains\localhost\packages\vitkuz573\my-package\vendor\laravel\framework\src\Illuminate\Foundation\Application.php:840
C:\OSPanel\domains\localhost\packages\vitkuz573\my-package\vendor\laravel\framework\src\Illuminate\Container\Container.php:1415
C:\OSPanel\domains\localhost\packages\vitkuz573\my-package\vendor\laravel\framework\src\Illuminate\Support\Facades\Facade.php:222
C:\OSPanel\domains\localhost\packages\vitkuz573\my-package\vendor\laravel\framework\src\Illuminate\Support\Facades\Facade.php:193
C:\OSPanel\domains\localhost\packages\vitkuz573\my-package\vendor\laravel\framework\src\Illuminate\Support\Facades\Facade.php:331
C:\OSPanel\domains\localhost\packages\vitkuz573\my-package\routes\routes.php:7
C:\OSPanel\domains\localhost\packages\vitkuz573\my-package\vendor\laravel\framework\src\Illuminate\Support\ServiceProvider.php:152
C:\OSPanel\domains\localhost\packages\vitkuz573\my-package\src\MyPackageServiceProvider.php:52
C:\OSPanel\domains\localhost\packages\vitkuz573\my-package\src\MyPackageServiceProvider.php:31
C:\OSPanel\domains\localhost\packages\vitkuz573\my-package\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:36
C:\OSPanel\domains\localhost\packages\vitkuz573\my-package\vendor\laravel\framework\src\Illuminate\Container\Util.php:41
C:\OSPanel\domains\localhost\packages\vitkuz573\my-package\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:93
C:\OSPanel\domains\localhost\packages\vitkuz573\my-package\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:37
C:\OSPanel\domains\localhost\packages\vitkuz573\my-package\vendor\laravel\framework\src\Illuminate\Container\Container.php:651
C:\OSPanel\domains\localhost\packages\vitkuz573\my-package\vendor\laravel\framework\src\Illuminate\Foundation\Application.php:928
C:\OSPanel\domains\localhost\packages\vitkuz573\my-package\vendor\laravel\framework\src\Illuminate\Foundation\Application.php:909
C:\OSPanel\domains\localhost\packages\vitkuz573\my-package\vendor\laravel\framework\src\Illuminate\Foundation\Application.php:910
C:\OSPanel\domains\localhost\packages\vitkuz573\my-package\vendor\laravel\framework\src\Illuminate\Foundation\Bootstrap\BootProviders.php:17
C:\OSPanel\domains\localhost\packages\vitkuz573\my-package\vendor\orchestra\testbench-core\src\Concerns\CreatesApplication.php:358
C:\OSPanel\domains\localhost\packages\vitkuz573\my-package\vendor\orchestra\testbench-core\src\Concerns\CreatesApplication.php:234
C:\OSPanel\domains\localhost\packages\vitkuz573\my-package\vendor\orchestra\testbench-core\src\TestCase.php:80
C:\OSPanel\domains\localhost\packages\vitkuz573\my-package\vendor\orchestra\testbench-core\src\Concerns\Testing.php:82
C:\OSPanel\domains\localhost\packages\vitkuz573\my-package\vendor\orchestra\testbench-core\src\TestCase.php:48
And at the same time, if I disable the route load (loadRoutesFrom) in the boot method of my service provider, then this error disappears. But of course I will not be able to test any routes.
Metadata
Metadata
Assignees
Labels
No labels