Skip to content

Commit 95b136a

Browse files
authored
Merge pull request #127 from laravel/refactor-all-command
Refactor creating laravel application instance using Testbench
2 parents cf03125 + 926c6f3 commit 95b136a

File tree

1 file changed

+9
-29
lines changed

1 file changed

+9
-29
lines changed

all.php

Lines changed: 9 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -8,35 +8,15 @@
88
use Laravel\Boost\Install\GuidelineConfig;
99
use Laravel\Boost\Install\Herd;
1010
use Laravel\Roster\Roster;
11-
use Orchestra\Testbench\Concerns\CreatesApplication;
12-
13-
// Create a simple class that uses Orchestra Testbench to bootstrap Laravel
14-
$testbench = new class
15-
{
16-
use CreatesApplication;
17-
18-
protected function getPackageProviders($app)
19-
{
20-
// No need to register Laravel Boost since we're just using Blade
21-
return [];
22-
}
23-
24-
protected function defineEnvironment($app)
25-
{
26-
// Set a .test URL to enable Herd guidelines if needed
27-
$app['config']->set('app.url', 'http://localhost.test');
28-
}
29-
30-
public function bootstrap()
31-
{
32-
$app = $this->createApplication();
33-
34-
return $app;
35-
}
36-
};
37-
38-
// Bootstrap the Laravel application
39-
$app = $testbench->bootstrap();
11+
use Orchestra\Testbench\Foundation\Application as Testbench;
12+
use Orchestra\Testbench\Foundation\Config as TestbenchConfig;
13+
14+
// Bootstrap the Laravel application using Testbench
15+
$app = Testbench::createFromConfig(new TestbenchConfig([
16+
'env' => [
17+
'APP_URL=http://localhost.test',
18+
],
19+
]), options: ['enables_package_discoveries' => false]);
4020

4121
// Create a mock Roster that returns ALL packages from .ai/ directory
4222
$mockRoster = new class extends Roster

0 commit comments

Comments
 (0)