File tree Expand file tree Collapse file tree 2 files changed +13
-6
lines changed Expand file tree Collapse file tree 2 files changed +13
-6
lines changed Original file line number Diff line number Diff line change 4
4
5
5
use Carbon \CarbonImmutable ;
6
6
use Illuminate \Console \Application as Artisan ;
7
+ use Illuminate \Contracts \Console \Kernel ;
7
8
use Illuminate \Database \Eloquent \Model ;
9
+ use Illuminate \Foundation \Application ;
8
10
use Illuminate \Foundation \Bootstrap \HandleExceptions ;
9
11
use Illuminate \Foundation \Http \Middleware \ConvertEmptyStringsToNull ;
10
12
use Illuminate \Foundation \Http \Middleware \TrimStrings ;
@@ -71,11 +73,16 @@ abstract class TestCase extends BaseTestCase
71
73
/**
72
74
* Creates the application.
73
75
*
74
- * Needs to be implemented by subclasses.
75
- *
76
- * @return \Symfony\Component\HttpKernel\HttpKernelInterface
76
+ * @return \Illuminate\Foundation\Application
77
77
*/
78
- abstract public function createApplication ();
78
+ public function createApplication ()
79
+ {
80
+ $ app = require Application::inferBaseDirectory ().'/bootstrap/app.php ' ;
81
+
82
+ $ app ->make (Kernel::class)->bootstrap ();
83
+
84
+ return $ app ;
85
+ }
79
86
80
87
/**
81
88
* Setup the test environment.
Original file line number Diff line number Diff line change 3
3
namespace Illuminate \Testing \Concerns ;
4
4
5
5
use Illuminate \Contracts \Console \Kernel ;
6
+ use Illuminate \Foundation \Application ;
6
7
use Illuminate \Support \Facades \ParallelTesting ;
7
8
use Illuminate \Testing \ParallelConsoleOutput ;
8
9
use RuntimeException ;
@@ -176,8 +177,7 @@ protected function createApplication()
176
177
};
177
178
178
179
return $ applicationCreator ->createApplication ();
179
- } elseif (file_exists ($ path = getcwd ().'/bootstrap/app.php ' ) ||
180
- file_exists ($ path = getcwd ().'/.laravel/app.php ' )) {
180
+ } elseif (file_exists ($ path = (Application::inferBaseDirectory ().'/bootstrap/app.php ' ))) {
181
181
$ app = require $ path ;
182
182
183
183
$ app ->make (Kernel::class)->bootstrap ();
You can’t perform that action at this time.
0 commit comments