From 1d654c8e8d5f85ec5edea395de3c4e92eeee0307 Mon Sep 17 00:00:00 2001 From: Mior Muhammad Zaki Date: Wed, 16 Aug 2023 08:14:03 +0800 Subject: [PATCH] wip Signed-off-by: Mior Muhammad Zaki --- src/Commands/Generator.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Commands/Generator.php b/src/Commands/Generator.php index 1460165..a85f241 100644 --- a/src/Commands/Generator.php +++ b/src/Commands/Generator.php @@ -2,6 +2,7 @@ namespace Orchestra\Canvas\Core\Commands; +use Illuminate\Console\Concerns\CreatesMatchingTest; use Orchestra\Canvas\Core\CodeGenerator; use Orchestra\Canvas\Core\Contracts\GeneratesCodeListener; use Orchestra\Canvas\Core\GeneratesCode; @@ -49,6 +50,10 @@ public function __construct(Preset $preset) { $this->files = $preset->filesystem(); + if (in_array(CreatesMatchingTest::class, class_uses_recursive($this))) { + $this->addTestOptions(); + } + parent::__construct($preset); } @@ -97,6 +102,10 @@ public function codeHasBeenGenerated(string $className): int { $this->components->info(sprintf('%s [%s] created successfully.', $this->type, $className)); + if (in_array(CreatesMatchingTest::class, class_uses_recursive($this))) { + $this->handleTestCreation($path); + } + return static::SUCCESS; }