mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 18:54:03 +00:00
Add support for arguments and options
This commit is contained in:
parent
cfaa6463ee
commit
3306b8e6de
3 changed files with 27 additions and 8 deletions
|
|
@ -108,8 +108,9 @@ class CommandsTest extends TestCase
|
|||
|
||||
Artisan::call('tenants:migrate', ['--tenants' => $uuid]);
|
||||
|
||||
$this->artisan("tenants:run foo --tenants=$uuid a b")
|
||||
$this->artisan("tenants:run foo --tenants=$uuid --argument='a=foo' --option='b=bar' --option='c=xyz'")
|
||||
->expectsOutput("User's name is Test command")
|
||||
->expectsOutput('a;b');
|
||||
->expectsOutput('foo')
|
||||
->expectsOutput('xyz');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ class ExampleCommand extends Command
|
|||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'foo {args*}';
|
||||
protected $signature = 'foo {a} {--b=} {--c=}';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
|
|
@ -28,7 +28,8 @@ class ExampleCommand extends Command
|
|||
]);
|
||||
|
||||
$this->line("User's name is " . User::find(999)->name);
|
||||
$this->line(implode(';', $this->argument('args')));
|
||||
$this->line($this->argument('a'));
|
||||
$this->line($this->option('c'));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue