Skip to content

Commit ba5bde7

Browse files
committed
add trait
1 parent b64d1e3 commit ba5bde7

File tree

2 files changed

+23
-21
lines changed

2 files changed

+23
-21
lines changed

tests/CreatesApplication.php

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
3+
namespace Tests;
4+
5+
use Illuminate\Contracts\Console\Kernel;
6+
7+
trait CreatesApplication
8+
{
9+
/**
10+
* Creates the application.
11+
*
12+
* @return \Illuminate\Foundation\Application
13+
*/
14+
public function createApplication()
15+
{
16+
$app = require __DIR__.'/../bootstrap/app.php';
17+
18+
$app->make(Kernel::class)->bootstrap();
19+
20+
return $app;
21+
}
22+
}

tests/TestCase.php

+1-21
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,9 @@
22

33
namespace Tests;
44

5-
use Illuminate\Contracts\Console\Kernel;
65
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
76

87
abstract class TestCase extends BaseTestCase
98
{
10-
/**
11-
* The base URL to use while testing the application.
12-
*
13-
* @var string
14-
*/
15-
protected $baseUrl = 'http://localhost';
16-
17-
/**
18-
* Creates the application.
19-
*
20-
* @return \Illuminate\Foundation\Application
21-
*/
22-
public function createApplication()
23-
{
24-
$app = require __DIR__.'/../bootstrap/app.php';
25-
26-
$app->make(Kernel::class)->bootstrap();
27-
28-
return $app;
29-
}
9+
use CreatesApplication;
3010
}

0 commit comments

Comments
 (0)