Skip to content

Commit 58e4234

Browse files
authored
[11.x] Add tests for make:enum command (#50184)
* Create EnumMakeCommandTest.php * add testItCanGenerateEnumFile * add testItCanGenerateEnumFileWithString * add testItCanGenerateEnumFileWithInt
1 parent 608a6b2 commit 58e4234

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?php
2+
3+
namespace Integration\Generators;
4+
5+
use Illuminate\Tests\Integration\Generators\TestCase;
6+
7+
class EnumMakeCommandTest extends TestCase
8+
{
9+
public function testItCanGenerateEnumFile()
10+
{
11+
$this->artisan('make:enum', ['name' => 'StatusEnum'])
12+
->assertExitCode(0);
13+
14+
$this->assertFileContains([
15+
'namespace App;',
16+
'enum StatusEnum',
17+
], 'app/StatusEnum.php');
18+
}
19+
20+
public function testItCanGenerateEnumFileWithString()
21+
{
22+
$this->artisan('make:enum', ['name' => 'StringEnum', '--string' => true])
23+
->assertExitCode(0);
24+
25+
$this->assertFileContains([
26+
'namespace App;',
27+
'enum StringEnum: string',
28+
], 'app/StringEnum.php');
29+
}
30+
31+
public function testItCanGenerateEnumFileWithInt()
32+
{
33+
$this->artisan('make:enum', ['name' => 'IntEnum', '--int' => true])
34+
->assertExitCode(0);
35+
36+
$this->assertFileContains([
37+
'namespace App;',
38+
'enum IntEnum: int',
39+
], 'app/IntEnum.php');
40+
}
41+
}

0 commit comments

Comments
 (0)