Skip to content

Commit 0c9aae5

Browse files
committed
wip
Signed-off-by: Mior Muhammad Zaki <[email protected]>
1 parent 1494452 commit 0c9aae5

File tree

4 files changed

+29
-1
lines changed

4 files changed

+29
-1
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"php": "^8.1",
99
"composer-runtime-api": "^2.2",
1010
"fakerphp/faker": "^1.21",
11-
"orchestra/workbench": "^8.9|^9.5",
11+
"orchestra/workbench": "^8.11|^9.7",
1212
"symfony/polyfill-php83": "^1.28"
1313
},
1414
"require-dev": {

src/Listeners/InstallingWorkbench.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use Illuminate\Contracts\Console\Kernel as ConsoleKernel;
66
use Illuminate\Filesystem\Filesystem;
77
use Orchestra\Workbench\Events\InstallStarted;
8+
use RuntimeException;
89

910
class InstallingWorkbench
1011
{
@@ -25,6 +26,10 @@ public function __construct(
2526
*/
2627
public function handle(InstallStarted $event)
2728
{
29+
if ($event->input->hasOption('basic') && $event->input->getOption('basic') === true) {
30+
throw new RuntimeException('Nova Devtool does not support installation with --basic` option');
31+
}
32+
2833
$this->kernel->call('make:user-model');
2934
$this->kernel->call('make:user-factory');
3035
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
3+
use Illuminate\Console\View\Components\Factory as ViewComponent;
4+
use Laravel\Nova\DevTool\Listeners\InstallingWorkbench;
5+
use Mockery as m;
6+
use Orchestra\Workbench\Events\InstallStarted;
7+
use Symfony\Component\Console\Input\InputInterface;
8+
use Symfony\Component\Console\Output\OutputInterface;
9+
10+
it('can throw exception if installation with `--basic` option', function () {
11+
$listener = app(InstallingWorkbench::class);
12+
$event = new InstallStarted(
13+
$input = m::mock(InputInterface::class),
14+
m::mock(OutputInterface::class),
15+
m::mock(ViewComponent::class),
16+
);
17+
18+
$input->shouldReceive('hasOption')->with('basic')->andReturnTrue();
19+
$input->shouldReceive('getOption')->with('basic')->andReturnTrue();
20+
21+
$listener->handle($event);
22+
})->throws(RuntimeException::class, 'Nova Devtool does not support installation with --basic` option');

tests/Pest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
*/
1515

1616
uses(Tests\TestCase::class)->in('Feature');
17+
// uses(PHPUnit\Framework\TestCase::class)->in('Unit');
1718

1819
/*
1920
|--------------------------------------------------------------------------

0 commit comments

Comments
 (0)