Skip to content

Commit 61d2309

Browse files
committed
Command Alias
Provides command alias `make:operation`
1 parent ef528f8 commit 61d2309

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

src/Commands/OneTimeOperationsMakeCommand.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@ class OneTimeOperationsMakeCommand extends OneTimeOperationsCommand
1313

1414
protected $description = 'Create a new one-time operation';
1515

16+
protected function configure(): void
17+
{
18+
$this->setAliases(['make:operation']);
19+
20+
parent::configure();
21+
}
22+
1623
public function handle(): int
1724
{
1825
try {

tests/Feature/OneTimeOperationCommandTest.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,17 @@ public function test_make_command_with_attributes()
3434
$this->assertStringContainsString('public function process(): void', $fileContent);
3535
}
3636

37+
public function test_make_command_alias()
38+
{
39+
$filepath = $this->filepath('2015_10_21_072800_awesome_operation.php');
40+
File::delete($filepath);
41+
42+
// create operation file
43+
$this->artisan('make:operation AwesomeOperation')
44+
->assertSuccessful()
45+
->expectsOutputToContain('One-time operation [2015_10_21_072800_awesome_operation] created successfully.');
46+
}
47+
3748
public function test_make_command_without_attributes()
3849
{
3950
$filepath = $this->filepath('2015_10_21_072800_awesome_operation.php');

0 commit comments

Comments
 (0)