More simply. phpunit.xml
<env name="DB_CONNECTION" value="sqlite"/>
<env name="DB_DATABASE" value=":memory:"/>
Edit config/database.php file. Add into connections Array new array like this:
'testing' => [
'driver' => env('DB_TEST_DRIVER'),
** | |
* Convert an array to XML. | |
* | |
* Examples: | |
* 1 - Simple array: | |
* $data = [ | |
* 'user' => [ | |
* 'name' => 'John', | |
* 'age' => 30, | |
* 'address' => [ 'city' => 'New York', 'state' => 'NY' ] |
/** | |
* @param array $arr Array where keys will be changed | |
* @param array $keys ['oldKey' => 'newKey'] | |
* @return array Array with changed keys | |
*/ | |
function change_array_keys(array $arr, array $keys) | |
{ | |
foreach (array_keys($keys) as $oldKey) | |
{ | |
if (array_key_exists($oldKey, $arr)) |
<?php | |
namespace App\Enums; | |
use ReflectionClass; | |
abstract class Enum | |
{ | |
/** | |
* Return an associative array with constant name as key and constant value as value. |
More simply. phpunit.xml
<env name="DB_CONNECTION" value="sqlite"/>
<env name="DB_DATABASE" value=":memory:"/>
Edit config/database.php file. Add into connections Array new array like this:
'testing' => [
'driver' => env('DB_TEST_DRIVER'),