Skip to content

Instantly share code, notes, and snippets.

@bedus-creation
Created November 21, 2018 06:16
Show Gist options
  • Save bedus-creation/a88c2c295f9def3137f07763b7a8651b to your computer and use it in GitHub Desktop.
Save bedus-creation/a88c2c295f9def3137f07763b7a8651b to your computer and use it in GitHub Desktop.
Force Sqlite in laravel Testing by setting up config in CreatesApplication.php
<?php
namespace Tests;
use Illuminate\Contracts\Console\Kernel;
use Illuminate\Support\Facades\Hash;
trait CreatesApplication
{
/**
* Creates the application.
*
* @return \Illuminate\Foundation\Application
*/
public function createApplication()
{
$app = require __DIR__.'/../bootstrap/app.php';
$app->make(Kernel::class)->bootstrap();
Hash::driver('bcrypt')->setRounds(4);
$app['config']->set('database.default','sqlite');
$app['config']->set('database.connections.sqlite.database', ':memory:');
return $app;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment