use new database for unit testing
add new testing connection to config/database.php
'testing' => [
'driver' => 'mysql',
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('TEST_DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'prefix' => '', 'strict' => true,
'engine' => null,]
Then open phpunit.xml file on root.
After that add <env name="DB_CONNECTION" value="testing"/> PHP section
Otherwise you can use sqlite cache.
Run test on single file
php vendor/bin/phpunit tests/Feature/BrokerRecordTest
0 comments:
Post a Comment