Skip to content

Commit

Permalink
Check existence of prompt form() function
Browse files Browse the repository at this point in the history
  • Loading branch information
JasperTey committed Nov 18, 2024
1 parent db9480b commit 5c89d4c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/Commands/ConfigCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ protected function layers()

protected function wizard(): int
{
if (! app('ddd')->laravelVersion(11)) {
$this->error('This command is only available in Laravel 11 and above.');
if (! function_exists('\Laravel\Prompts\form')) {
$this->error('This command is not supported with your currently installed version of Laravel Prompts.');

return self::FAILURE;
}
Expand Down
8 changes: 4 additions & 4 deletions tests/Command/ConfigTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,15 @@
$this->artisan('config:clear')->assertSuccessful()->execute();

unlink($configPath);
})->skipOnLaravelVersionsBelow(11);
})->skip(fn () => ! function_exists('\Laravel\Prompts\form'));

it('requires laravel 11 to run the wizard', function () {
it('requires \Laravel\Prompts\form to run the wizard', function () {
$this->artisan('ddd:config')
->expectsQuestion('Laravel-DDD Config Utility', 'wizard')
->expectsOutput('This command is only available in Laravel 11 and above.')
->expectsOutput('This command is not supported with your currently installed version of Laravel Prompts.')
->assertFailed()
->execute();
})->onlyOnLaravelVersionsBelow(11);
})->skip(fn () => function_exists('\Laravel\Prompts\form'));

it('can update and merge ddd.php with latest package version', function () {
$configPath = config_path('ddd.php');
Expand Down

0 comments on commit 5c89d4c

Please sign in to comment.