@@ -18,9 +18,6 @@ public function test_make_command_with_attributes()
1818 $ filepath = $ this ->filepath ('2015_10_21_072800_awesome_operation.php ' );
1919 File::delete ($ filepath );
2020
21- // no files, database entries or jobs
22- $ this ->assertFileDoesNotExist ($ filepath );
23-
2421 // create operation file
2522 $ this ->artisan ('operations:make AwesomeOperation ' )
2623 ->assertSuccessful ()
@@ -37,6 +34,44 @@ public function test_make_command_with_attributes()
3734 $ this ->assertStringContainsString ('public function process(): void ' , $ fileContent );
3835 }
3936
37+ public function test_make_command_without_attributes ()
38+ {
39+ $ filepath = $ this ->filepath ('2015_10_21_072800_awesome_operation.php ' );
40+ File::delete ($ filepath );
41+
42+ // create operation file with essential flag
43+ $ this ->artisan ('operations:make AwesomeOperation --essential ' )->assertSuccessful ();
44+
45+ $ fileContent = File::get ($ filepath );
46+
47+ // file should contain method
48+ $ this ->assertStringContainsString ('public function process(): void ' , $ fileContent );
49+
50+ // file should not contain attributes
51+ $ this ->assertStringNotContainsString ('protected bool $async = true; ' , $ fileContent );
52+ $ this ->assertStringNotContainsString ('protected string $queue = \'default \'; ' , $ fileContent );
53+ $ this ->assertStringNotContainsString ('protected ?string $tag = null; ' , $ fileContent );
54+ }
55+
56+ public function test_make_command_without_attributes_shortcut ()
57+ {
58+ $ filepath = $ this ->filepath ('2015_10_21_072800_awesome_operation.php ' );
59+ File::delete ($ filepath );
60+
61+ // create operation file with shortcut for essential flag
62+ $ this ->artisan ('operations:make AwesomeOperation -e ' )->assertSuccessful ();
63+
64+ $ fileContent = File::get ($ filepath );
65+
66+ // file should contain method
67+ $ this ->assertStringContainsString ('public function process(): void ' , $ fileContent );
68+
69+ // file should not contain attributes
70+ $ this ->assertStringNotContainsString ('protected bool $async = true; ' , $ fileContent );
71+ $ this ->assertStringNotContainsString ('protected string $queue = \'default \'; ' , $ fileContent );
72+ $ this ->assertStringNotContainsString ('protected ?string $tag = null; ' , $ fileContent );
73+ }
74+
4075 /** @test */
4176 public function test_the_whole_command_process ()
4277 {
0 commit comments