G
G
Gleb Starkov2020-06-17 10:05:20
PHPUnit
Gleb Starkov, 2020-06-17 10:05:20

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

1 answer(s)
A
Anton Anton, 2020-06-17
@colonel

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 question

Ask a Question

731 491 924 answers to any question