Answer the question
In order to leave comments, you need to log in
Laravel 7 error in PHPUnit postJson?
I am writing an API on Laravel 7.
The documentation has a postJson method, but when starting tests, it gives an error:
Call to undefined method Tests\Unit\NoteTest::postJson()
Answer the question
In order to leave comments, you need to log in
This is in feature tests, but not in unit tests. They are in different namespaces, although they are called the same.
Although nothing prevents changing to,
except that this will slightly violate the logic of placing tests.
use PHPUnit\Framework\TestCase;
use Tests\TestCase;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question