user info
This commit is contained in:
26
tests/AircraftTest.php
Normal file
26
tests/AircraftTest.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Foundation\Testing\WithoutMiddleware;
|
||||
use Illuminate\Foundation\Testing\DatabaseMigrations;
|
||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||
|
||||
|
||||
class AircraftTest extends TestCase
|
||||
{
|
||||
|
||||
protected $repo;
|
||||
|
||||
public function setUp() {
|
||||
parent::setUp();
|
||||
$this->repo = $this->createRepository('AircraftRepository');
|
||||
}
|
||||
/**
|
||||
* A basic test example.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testRepository()
|
||||
{
|
||||
print_r($this->repo->model());
|
||||
}
|
||||
}
|
||||
@@ -7,8 +7,13 @@ abstract class TestCase extends Illuminate\Foundation\Testing\TestCase
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $app;
|
||||
protected $baseUrl = 'http://localhost';
|
||||
|
||||
public function __construct($name = null, array $data = [], $dataName = '') {
|
||||
parent::__construct($name, $data, $dataName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the application.
|
||||
*
|
||||
@@ -17,9 +22,12 @@ abstract class TestCase extends Illuminate\Foundation\Testing\TestCase
|
||||
public function createApplication()
|
||||
{
|
||||
$app = require __DIR__.'/../bootstrap/app.php';
|
||||
|
||||
$app->make(Illuminate\Contracts\Console\Kernel::class)->bootstrap();
|
||||
|
||||
return $app;
|
||||
}
|
||||
|
||||
public function createRepository($repo_name) {
|
||||
$app = $this->createApplication();
|
||||
return $app->make('App\Repositories\\' + $repo_name);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user