From b6617d78c34f1a0e0f65bea3a1e06d27b8723043 Mon Sep 17 00:00:00 2001 From: Jasper Tey Date: Tue, 12 Nov 2024 00:36:08 -0500 Subject: [PATCH] Ensure nameInput is studly. --- src/Support/GeneratorBlueprint.php | 3 +-- tests/Generator/ActionMakeTest.php | 4 +++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Support/GeneratorBlueprint.php b/src/Support/GeneratorBlueprint.php index 5d2aa6c..6333347 100644 --- a/src/Support/GeneratorBlueprint.php +++ b/src/Support/GeneratorBlueprint.php @@ -4,7 +4,6 @@ use Illuminate\Console\Command; use Illuminate\Support\Facades\App; -use Illuminate\Support\Str; use Lunarstorm\LaravelDDD\ValueObjects\CommandContext; use Lunarstorm\LaravelDDD\ValueObjects\ObjectSchema; @@ -31,7 +30,7 @@ public function __construct( string $domainName, Command $command, ) { - $this->nameInput = Str::replace(['.', '\\', '/'], '/', $nameInput); + $this->nameInput = str($nameInput)->studly()->replace(['.', '\\', '/'], '/')->toString(); $this->domain = new Domain($domainName); diff --git a/tests/Generator/ActionMakeTest.php b/tests/Generator/ActionMakeTest.php index 52148fb..a94e289 100644 --- a/tests/Generator/ActionMakeTest.php +++ b/tests/Generator/ActionMakeTest.php @@ -55,10 +55,12 @@ "{$normalized}.php", ])); + dump($expectedPath); + Artisan::call("ddd:action {$domain}:{$given}"); expect(file_exists($expectedPath))->toBeTrue("ddd:action {$domain}:{$given} -> expected {$expectedPath} to exist."); -})->with('makeActionInputs'); +})->with('makeActionInputs')->only(); it('extends a base action if specified in config', function ($baseAction) { Config::set('ddd.base_action', $baseAction);