49 lines
1.2 KiB
PHP
Executable File
49 lines
1.2 KiB
PHP
Executable File
<?php
|
|
|
|
abstract class TestCase extends Illuminate\Foundation\Testing\TestCase
|
|
{
|
|
/**
|
|
* The base URL to use while testing the application.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $app;
|
|
protected $baseUrl = 'http://localhost';
|
|
protected $connectionsToTransact = ['testing'];
|
|
|
|
public function __construct($name = null, array $data = [], $dataName = '') {
|
|
parent::__construct($name, $data, $dataName);
|
|
}
|
|
|
|
protected function reset_db(){
|
|
exec('make -f ' . __DIR__ . '/../Makefile unittest-db');
|
|
}
|
|
|
|
public function setUp() {
|
|
parent::setUp();
|
|
$this->reset_db();
|
|
/*
|
|
Artisan::call('migrate');
|
|
Artisan::call('db:seed');
|
|
*/
|
|
}
|
|
|
|
/**
|
|
* Creates the application.
|
|
*
|
|
* @return \Illuminate\Foundation\Application
|
|
*/
|
|
public function createApplication()
|
|
{
|
|
$app = require __DIR__.'/../bootstrap/app.php';
|
|
$app->make(Illuminate\Contracts\Console\Kernel::class)->bootstrap();
|
|
//$app['config']->set('database.default','testing');
|
|
return $app;
|
|
}
|
|
|
|
public function createRepository($repo_name) {
|
|
$app = $this->createApplication();
|
|
return $app->make('App\Repositories\\' . $repo_name);
|
|
}
|
|
}
|