PHPUnit is well integrated with Laravel 5 as it was with Laravel 4, so it is rather easy to set up the testing environment. A good method for testing would be to use the SQLite database and to set it up to reside in the memory, but you need to modify the
config/database.php file, as follows:
'default' => 'sqlite', 'connections' => array( 'sqlite' => array( 'driver' => 'sqlite', 'database' => ':memory:', 'prefix' => '', ), ),
Then, we need to modify the
phpunit.xml file to set a
DB_DRIVER environment variable:
<php> <env name="APP_ENV" value="testing"/> <env name="CACHE_DRIVER" value="array"/> <env name="SESSION_DRIVER" value="array"/> <env name="DB_DRIVER" value="sqlite"/> </php>
Then, we need to modify the following ...