Skip to content

Commit 79e09fe

Browse files
committed
wip
Signed-off-by: Mior Muhammad Zaki <[email protected]>
1 parent c1846ee commit 79e09fe

9 files changed

+33
-56
lines changed

src/Console/Concerns/InteractsWithProcess.php

+1-3
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,8 @@ trait InteractsWithProcess
88
{
99
/**
1010
* Run the given command as a process.
11-
*
12-
* @return void
1311
*/
14-
protected function executeCommand(string $command, string $path)
12+
protected function executeCommand(string $command, string $path): void
1513
{
1614
$process = Process::fromShellCommandline($command, $path)->setTimeout(null);
1715

src/Listeners/InstalledWorkbench.php

+12-17
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,16 @@
99
use Orchestra\Workbench\Events\InstallEnded;
1010
use Orchestra\Workbench\Workbench;
1111

12+
use function Illuminate\Filesystem\join_paths;
13+
1214
class InstalledWorkbench
1315
{
14-
/**
15-
* The filesystem instance.
16-
*
17-
* @var \Illuminate\Filesystem\Filesystem;
18-
*/
19-
public $files;
20-
2116
/**
2217
* Construct a new event listener.
2318
*/
24-
public function __construct(Filesystem $files)
19+
public function __construct(public Filesystem $files)
2520
{
26-
$this->files = $files;
21+
//
2722
}
2823

2924
/**
@@ -49,35 +44,35 @@ public function handle(InstallEnded $event)
4944
components: $event->components,
5045
workingPath: $workingDirectory,
5146
))->handle(
52-
$workingDirectory.DIRECTORY_SEPARATOR.'base-resource.stub',
53-
Workbench::path('app/Nova/Resource.php')
47+
join_paths($workingDirectory, 'base-resource.stub'),
48+
Workbench::path(['app', 'Nova', 'Resource.php'])
5449
);
5550

5651
(new GeneratesFile(
5752
filesystem: $this->files,
5853
components: $event->components,
5954
workingPath: $workingDirectory,
6055
))->handle(
61-
$workingDirectory.DIRECTORY_SEPARATOR.'UserResource.stub',
62-
Workbench::path('app/Nova/User.php')
56+
join_paths($workingDirectory, 'UserResource.stub'),
57+
Workbench::path(['app', 'Nova', 'User.php'])
6358
);
6459

6560
(new GeneratesFile(
6661
filesystem: $this->files,
6762
components: $event->components,
6863
workingPath: $workingDirectory,
6964
))->handle(
70-
$workingDirectory.DIRECTORY_SEPARATOR.'NovaServiceProvider.stub',
71-
Workbench::path('app/Providers/NovaServiceProvider.php')
65+
join_paths($workingDirectory, 'NovaServiceProvider.stub'),
66+
Workbench::path(['app', 'Providers', 'NovaServiceProvider.php'])
7267
);
7368

7469
(new GeneratesFile(
7570
filesystem: $this->files,
7671
components: $event->components,
7772
workingPath: $workingDirectory,
7873
))->handle(
79-
$workingDirectory.DIRECTORY_SEPARATOR.'DatabaseSeeder.stub',
80-
Workbench::path('database/seeders/DatabaseSeeder.php')
74+
join_paths($workingDirectory, 'DatabaseSeeder.stub'),
75+
Workbench::path(['database', 'seeders', 'DatabaseSeeder.php'])
8176
);
8277

8378
Collection::make([

src/Listeners/InstallingWorkbench.php

+5-10
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,16 @@
77
use Orchestra\Workbench\Events\InstallStarted;
88
use Orchestra\Workbench\Workbench;
99

10+
use function Illuminate\Filesystem\join_paths;
11+
1012
class InstallingWorkbench
1113
{
12-
/**
13-
* The filesystem instance.
14-
*
15-
* @var \Illuminate\Filesystem\Filesystem;
16-
*/
17-
public $files;
18-
1914
/**
2015
* Construct a new event listener.
2116
*/
22-
public function __construct(Filesystem $files)
17+
public function __construct(public Filesystem $files)
2318
{
24-
$this->files = $files;
19+
//
2520
}
2621

2722
/**
@@ -38,7 +33,7 @@ public function handle(InstallStarted $event)
3833
components: $event->components,
3934
workingPath: $workingDirectory,
4035
))->handle(
41-
$workingDirectory.DIRECTORY_SEPARATOR.'testbench.stub',
36+
join_paths($workingDirectory, 'testbench.stub'),
4237
Workbench::packagePath('testbench.yaml')
4338
);
4439
}

tests/Feature/Console/ActionCommandTest.php

+6-9
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ class ActionCommandTest extends TestCase
1313
'app/Nova/Actions/Sleep.php',
1414
];
1515

16-
/** @test */
17-
public function it_can_generate_action_file()
16+
public function test_it_can_generate_action_file()
1817
{
1918
$this->artisan('nova:action', ['name' => 'Sleep', '--preset' => 'laravel'])
2019
->assertSuccessful();
@@ -25,12 +24,12 @@ public function it_can_generate_action_file()
2524
'use Illuminate\Queue\InteractsWithQueue;',
2625
'use Laravel\Nova\Actions\Action;',
2726
'class Sleep extends Action',
28-
'use InteractsWithQueue, Queueable;',
27+
'use InteractsWithQueue;',
28+
'use Queueable;',
2929
], 'app/Nova/Actions/Sleep.php');
3030
}
3131

32-
/** @test */
33-
public function it_can_generate_queued_action_file()
32+
public function test_it_can_generate_queued_action_file()
3433
{
3534
$this->artisan('nova:action', ['name' => 'Sleep', '--queued' => true, '--preset' => 'laravel'])
3635
->assertSuccessful();
@@ -53,8 +52,7 @@ public function it_can_generate_queued_action_file()
5352
], 'app/Nova/Actions/Sleep.php');
5453
}
5554

56-
/** @test */
57-
public function it_can_generate_destructive_action_file()
55+
public function test_it_can_generate_destructive_action_file()
5856
{
5957
$this->artisan('nova:action', ['name' => 'Sleep', '--destructive' => true, '--preset' => 'laravel'])
6058
->assertSuccessful();
@@ -66,8 +64,7 @@ public function it_can_generate_destructive_action_file()
6664
], 'app/Nova/Actions/Sleep.php');
6765
}
6866

69-
/** @test */
70-
public function it_can_generate_queued_destructive_action_file()
67+
public function test_it_can_generate_queued_destructive_action_file()
7168
{
7269
$this->artisan('nova:action', ['name' => 'Sleep', '--queued' => true, '--destructive' => true, '--preset' => 'laravel'])
7370
->assertSuccessful();

tests/Feature/Console/BaseResourceCommandTest.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ class BaseResourceCommandTest extends TestCase
1313
'app/Nova/Post.php',
1414
];
1515

16-
/** @test */
17-
public function it_can_generate_resource_file()
16+
public function test_it_can_generate_resource_file()
1817
{
1918
$this->artisan('nova:base-resource', ['name' => 'Resource', '--preset' => 'laravel'])
2019
->assertSuccessful();

tests/Feature/Console/DashboardCommandTest.php

+2-4
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ class DashboardCommandTest extends TestCase
1414
'app/Nova/Dashboards/Post.php',
1515
];
1616

17-
/** @test */
18-
public function it_can_generate_dashboard_file()
17+
public function test_it_can_generate_dashboard_file()
1918
{
2019
$this->artisan('nova:dashboard', ['name' => 'Post', '--preset' => 'laravel'])
2120
->assertSuccessful();
@@ -27,8 +26,7 @@ public function it_can_generate_dashboard_file()
2726
], 'app/Nova/Dashboards/Post.php');
2827
}
2928

30-
/** @test */
31-
public function it_can_generate_the_main_dashboard_file()
29+
public function test_it_can_generate_the_main_dashboard_file()
3230
{
3331
$this->artisan('nova:dashboard', ['name' => 'Main', '--preset' => 'laravel'])
3432
->assertSuccessful();

tests/Feature/Console/FilterCommandTest.php

+3-6
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ class FilterCommandTest extends TestCase
1313
'app/Nova/Filters/Post.php',
1414
];
1515

16-
/** @test */
17-
public function it_can_generate_filter_file()
16+
public function test_it_can_generate_filter_file()
1817
{
1918
$this->artisan('nova:filter', ['name' => 'Post', '--preset' => 'laravel'])
2019
->assertSuccessful();
@@ -28,8 +27,7 @@ public function it_can_generate_filter_file()
2827
], 'app/Nova/Filters/Post.php');
2928
}
3029

31-
/** @test */
32-
public function it_can_generate_filter_file_with_boolean_type()
30+
public function test_it_can_generate_filter_file_with_boolean_type()
3331
{
3432
$this->artisan('nova:filter', ['name' => 'Post', '--boolean' => true, '--preset' => 'laravel'])
3533
->assertSuccessful();
@@ -42,8 +40,7 @@ public function it_can_generate_filter_file_with_boolean_type()
4240
], 'app/Nova/Filters/Post.php');
4341
}
4442

45-
/** @test */
46-
public function it_can_generate_filter_file_with_date_type()
43+
public function test_it_can_generate_filter_file_with_date_type()
4744
{
4845
$this->artisan('nova:filter', ['name' => 'Post', '--date' => true, '--preset' => 'laravel'])
4946
->assertSuccessful();

tests/Feature/Console/LensCommandTest.php

+2-3
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ class LensCommandTest extends TestCase
1313
'app/Nova/Lenses/Post.php',
1414
];
1515

16-
/** @test */
17-
public function it_can_generate_lens_file()
16+
public function test_it_can_generate_lens_file()
1817
{
1918
$this->artisan('nova:lens', ['name' => 'Post', '--preset' => 'laravel'])
2019
->assertSuccessful();
@@ -25,7 +24,7 @@ public function it_can_generate_lens_file()
2524
'use Laravel\Nova\Http\Requests\NovaRequest;',
2625
'use Laravel\Nova\Lenses\Lens;',
2726
'class Post extends Lens',
28-
'public static function query(LensRequest $request, $query)',
27+
'public static function query(LensRequest $request, Builder $query): Builder|Paginator',
2928
], 'app/Nova/Lenses/Post.php');
3029
}
3130
}

tests/Feature/Console/ResourceCommandTest.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ class ResourceCommandTest extends TestCase
1414
'app/Nova/Resource.php',
1515
];
1616

17-
/** @test */
18-
public function it_can_generate_resource_file()
17+
public function test_it_can_generate_resource_file()
1918
{
2019
$this->artisan('nova:resource', ['name' => 'Post', '--preset' => 'laravel'])
2120
->assertSuccessful();

0 commit comments

Comments
 (0)