Created
November 21, 2018 06:16
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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