diff --git a/tests/Command/StubTest.php b/tests/Command/StubTest.php index 7479214..6960cba 100644 --- a/tests/Command/StubTest.php +++ b/tests/Command/StubTest.php @@ -118,11 +118,38 @@ } })->with([ 'model*' => ['model*', ['model', 'model.pivot']], - 'model.' => ['model*', ['model', 'model.pivot']], + 'model.' => ['model.', ['model', 'model.pivot']], 'listener*' => ['listener*', ['listener', 'listener.typed', 'listener.queued', 'listener.typed.queued']], - 'listener.' => ['listener*', ['listener', 'listener.typed', 'listener.queued', 'listener.typed.queued']], + 'listener.' => ['listener.', ['listener', 'listener.typed', 'listener.queued', 'listener.typed.queued']], ]); +it('can publish stubs using wildcard (laravel 11 stubs)', function ($argument, $stubsToPublish) { + $expectedStubFilenames = collect($stubsToPublish) + ->map(fn ($stub) => $stub.'.stub') + ->all(); + + $this + ->artisan("ddd:stub {$argument}") + ->assertSuccessful() + ->execute(); + + $publishedStubFolder = app()->basePath('stubs/ddd'); + + assertDirectoryExists($publishedStubFolder); + + $stubFiles = File::files($publishedStubFolder); + + expect(count($stubFiles))->toEqual(count($stubsToPublish)); + + foreach ($stubFiles as $file) { + expect($file->getFilename())->toBeIn($expectedStubFilenames); + } +})->with([ + 'listener*' => ['listener*', ['listener', 'listener.typed', 'listener.queued', 'listener.typed.queued']], + 'listener.' => ['listener.', ['listener', 'listener.typed', 'listener.queued', 'listener.typed.queued']], + 'enum.' => ['enum.', ['enum', 'enum.backed']], +])->skipOnLaravelVersionsBelow(11); + it('can publish specific stubs interactively', function () { $publishedStubFolder = app()->basePath('stubs/ddd');