3 years ago

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.


class ProgramTest extends TestCase {

    /** @test */
    public function it_returns_index() {
             ->assertReturnOk(['limit' => 10]);

    /** @test */
    public function it_returns_show() {
             ->seeJson(['id' => 12]);
PHPUnit 4.8.23 by Sebastian Bergmann and contributors.
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.