Beispiel #1
0
 public function setUpRealSQLiteDb()
 {
     $app = app();
     // set the untransacted database driver to be a mirror of the default driver
     $default_driver = 'testing_real_sqlite';
     DB::setDefaultConnection($default_driver);
     // duplicate the untransacted database driver
     $connections = $app['config']['database.connections'];
     config(['database.connections.untransacted' => $connections[$default_driver]]);
     // create the blank db sqlite file (even if it already exists)
     $path = $connections[$default_driver]['database'];
     if (is_dir(dirname($path))) {
         file_put_contents($path, '');
     }
     // migrate the database
     $this->app['Illuminate\\Contracts\\Console\\Kernel']->call('migrate');
     // also migrate the untrasacted in-memory database
     $this->app['Illuminate\\Contracts\\Console\\Kernel']->call('migrate', ['--database' => 'untransacted']);
 }