We are using the PHPUnit test for this article. PHPUnit Test in Laravel. The phpunit.xml file is already configured for our Laravel application. By default Laravel ships with two directories and two files.
When we are running the tests via PHPUnit then Laravel will set the environment to test automatically. It configures the cache and session environment to the array driver. So while testing, no session or cache data is persisted. You can actually see it in the below code. Go to the phpunit.xml file.
<php>
<env name="APP_ENV" value="testing"/>
<env name="CACHE_DRIVER" value="array"/>
<env name="SESSION_DRIVER" value="array"/>
<env name="QUEUE_DRIVER" value="sync"/>
</php>
The first step would be to install a brand new Laravel Project.
#laravel #laravel application #phpunit.xml #phpunit