pilat
6 months ago
357
9
Testing

Feature tests do not work (404)

Posted 6 months ago by pilat

Hi, I'm having this little (I'm sure) problem with testing, but I seem to be stuck as I don't know how to troubleshoot it further. There just seem to be not enough info…

Here's the test (simplified):

    /**
     * A basic feature test example.
     *
     * @return void
     */
    public function testUserCanVote()
    {
        $this->withoutExceptionHandling();

        $postData = [/* ... */]; // fill in some data;

        $response = $this->postJson('api/vote', $postData);
    }

Here's the response:

$ php7.2 ./vendor/bin/phpunit tests/Feature/VoteTest.php
PHPUnit 7.5.8 by Sebastian Bergmann and contributors.

Time: 171 ms, Memory: 16.00 MB

There was 1 error:

1) Tests\Feature\VoteTest::testUserCanVote
Symfony\Component\HttpKernel\Exception\NotFoundHttpException: POST http://MYSITE_REPLACED.info/back/public/api/vote

.../public_html/back/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/InteractsWithExceptionHandling.php:118
.../public_html/back/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php:326
.../public_html/back/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php:120
.../public_html/back/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/MakesHttpRequests.php:347
.../public_html/back/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/MakesHttpRequests.php:319
.../public_html/back/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/MakesHttpRequests.php:210
.../public_html/back/tests/Feature/VoteTest.php:51

ERRORS!
Tests: 1, Assertions: 0, Errors: 1.

Notes:

Laravel 5.8.

Please sign in or create an account to participate in this conversation.