The test environment is enabled in the
Tests\TestCase
class via the
createApplication()
method, but not in the
PHPUnit\Framework\TestCase
class.
So why then when the artisan creates a new test that extends from
PHPUnit\Framework\TestCase
class?
I figured it all out!
When create a unitest with
command.
Such tests should not affect the database. Therefore, it is not necessary to change the environment for such tests.
And so the test class extends from the
class.
But if create a test without the --unit flag
Then the test class extends from the
class, which leads to automatic execution of the
method and a change in the environment.