mirror of
https://github.com/laravel/laravel.git
synced 2025-02-20 11:53:14 +08:00
add trait
This commit is contained in:
parent
b64d1e3dc8
commit
ba5bde7c91
22
tests/CreatesApplication.php
Normal file
22
tests/CreatesApplication.php
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests;
|
||||||
|
|
||||||
|
use Illuminate\Contracts\Console\Kernel;
|
||||||
|
|
||||||
|
trait CreatesApplication
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Creates the application.
|
||||||
|
*
|
||||||
|
* @return \Illuminate\Foundation\Application
|
||||||
|
*/
|
||||||
|
public function createApplication()
|
||||||
|
{
|
||||||
|
$app = require __DIR__.'/../bootstrap/app.php';
|
||||||
|
|
||||||
|
$app->make(Kernel::class)->bootstrap();
|
||||||
|
|
||||||
|
return $app;
|
||||||
|
}
|
||||||
|
}
|
@ -2,29 +2,9 @@
|
|||||||
|
|
||||||
namespace Tests;
|
namespace Tests;
|
||||||
|
|
||||||
use Illuminate\Contracts\Console\Kernel;
|
|
||||||
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
|
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
|
||||||
|
|
||||||
abstract class TestCase extends BaseTestCase
|
abstract class TestCase extends BaseTestCase
|
||||||
{
|
{
|
||||||
/**
|
use CreatesApplication;
|
||||||
* The base URL to use while testing the application.
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
protected $baseUrl = 'http://localhost';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates the application.
|
|
||||||
*
|
|
||||||
* @return \Illuminate\Foundation\Application
|
|
||||||
*/
|
|
||||||
public function createApplication()
|
|
||||||
{
|
|
||||||
$app = require __DIR__.'/../bootstrap/app.php';
|
|
||||||
|
|
||||||
$app->make(Kernel::class)->bootstrap();
|
|
||||||
|
|
||||||
return $app;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user