spatie / pest-plugin-route-testing

Make sure all routes in your Laravel app are ok
https://freek.dev/2739-how-to-test-all-routes-in-your-laravel-app-by-writing-just-a-single-pest-test
MIT License
66 stars 2 forks source link

Target [Illuminate\Contracts\Routing\UrlGenerator] is not instantiable. #11

Closed renege closed 1 month ago

renege commented 1 month ago

For:

<?php

namespace Tests\Feature;

use function Spatie\RouteTesting\routeTesting;

routeTesting('all api routes')->include('api/*')->assertSuccessful();

In latest version (L11)

php artisan test

PASS Tests\Unit\ExampleTest ✓ that true is true

PASS Tests\Feature\ExampleTest ✓ the application returns a successful response 0.43s

FAIL Tests\Feature\RouteApiTest ⨯ all api routes with ('GET', 'api/test') 0.01s
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
FAILED Tests\Feature\RouteApiTest > all api routes with ('GET', 'api/test') BindingResolutionException
Target [Illuminate\Contracts\Routing\UrlGenerator] is not instantiable.

at vendor/laravel/framework/src/Illuminate/Container/Container.php:1202 1198▕ } else { 1199▕ $message = "Target [$concrete] is not instantiable."; 1200▕ } 1201▕ ➜ 1202▕ throw new BindingResolutionException($message); 1203▕ } 1204▕ 1205▕ /* 1206▕ Throw an exception for an unresolvable primitive.

Tests: 1 failed, 2 passed (2 assertions) Duration: 1.08s