A Persistent NotFoundHttpException: Trouble Running Livewire Tests on API for Retrieving All Model Records
Hello! I'm having trouble running a test on my API that returns all records from the user model. It's simple. The goal is to retrieve all data from this model. It is working fine both in the browser, in any mode, and in Postman. It always returns the data as JSON. Perfect. That's it. I created both the tests and controllers with Livewire. I'm using the latest version of Laravel, Livewire, etc. I'll share with you guys, the code of the controller that works perfectly, as well as the test code, my routes file, etc. First, here's the error message that appears in my test. lab03@devlab03:/var/www/virtual-card$ sudo php artisan test --filter ApiBuzCardTest::the_api_return_all_users
FAIL Tests\Feature\Livewire\Api\ApiBuzCardTest ⨯ the api return all users 0.08s ───────────────────────────────────────────── FAILED Tests\Feature\Livewire\Api\ApiBuzCardTest > the api return all users NotFoundHttpException GET https://devlab03.mshome.net/virtual-card/api/users
at vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:51 47▕ $handler = $this->container->make(ExceptionHandler::class); 48▕ 49▕ $handler->report($e); 50▕ ➜ 51▕ $response = $handler->render($passable, $e); 52▕ 53▕ if (is_object($response) && method_exists($response, 'withException')) { 54▕ $response->withException($e); 55▕ }
+42 vendor frames
43 tests/Feature/Livewire/Api/ApiBuzCardTest.php:17
Tests: 1 failed (0 assertions) Duration: 0.12s
My Controller File: app/Http/Livewire/Api/ApiBuzCard.php
Please or to participate in this conversation.