diff --git a/tests/Integration/Generators/EnumMakeCommandTest.php b/tests/Integration/Generators/EnumMakeCommandTest.php index 43feaeba2da5..0aba736c80e5 100644 --- a/tests/Integration/Generators/EnumMakeCommandTest.php +++ b/tests/Integration/Generators/EnumMakeCommandTest.php @@ -6,6 +6,13 @@ class EnumMakeCommandTest extends TestCase { + protected $files = [ + 'app/IntEnum.php', + 'app/StatusEnum.php', + 'app/StringEnum.php', + 'app/*/OrderStatusEnum.php', + ]; + public function testItCanGenerateEnumFile() { $this->artisan('make:enum', ['name' => 'StatusEnum']) @@ -38,4 +45,44 @@ public function testItCanGenerateEnumFileWithInt() 'enum IntEnum: int', ], 'app/IntEnum.php'); } + + public function testItCanGenerateEnumFileInEnumsFolder() + { + $enumsFolderPath = app_path('Enums'); + + /** @var \Illuminate\Filesystem\Filesystem $files */ + $files = $this->app['files']; + + $files->ensureDirectoryExists($enumsFolderPath); + + $this->artisan('make:enum', ['name' => 'OrderStatusEnum']) + ->assertExitCode(0); + + $this->assertFileContains([ + 'namespace App\Enums;', + 'enum OrderStatusEnum', + ], 'app/Enums/OrderStatusEnum.php'); + + $files->deleteDirectory($enumsFolderPath); + } + + public function testItCanGenerateEnumFileInEnumerationsFolder() + { + $enumerationsFolderPath = app_path('Enumerations'); + + /** @var \Illuminate\Filesystem\Filesystem $files */ + $files = $this->app['files']; + + $files->ensureDirectoryExists($enumerationsFolderPath); + + $this->artisan('make:enum', ['name' => 'OrderStatusEnum']) + ->assertExitCode(0); + + $this->assertFileContains([ + 'namespace App\Enumerations;', + 'enum OrderStatusEnum', + ], 'app/Enumerations/OrderStatusEnum.php'); + + $files->deleteDirectory($enumerationsFolderPath); + } }