Darival
210
2
Testing

Test Api 404 on multiple requests

Posted 3 years ago by Darival

Hi, I'm trying to test all the routes on my api but only the first request gets 200, all following requests get 404, but when I run any test individually (phpunit --filter test_something) they work.

<?php

class ProgramTest extends TestCase {

    /** @test */
    public function it_returns_index() {
        $this->get('api/v1/test')
             ->assertReturnOk(['limit' => 10]);
    }

    /** @test */
    public function it_returns_show() {
        $this->get('api/v1/test/12')
             ->seeJson(['id' => 12]);
    }
}
PHPUnit 4.8.23 by Sebastian Bergmann and contributors.
.F
Time: 2.33 seconds, Memory: 20.25Mb
There was 1 failure:
1) ProgramTest::it_returns_show
Invalid JSON was returned from the route. Perhaps an exception was thrown?

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

Reply to

Use Markdown with GitHub-flavored code blocks.