mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-12 14:34:04 +00:00
[4.x] Fix tenants:run argument parsing (#1287)
* Use StringInput instead of ArgvInput so that tenants:run accepts args properly * Test that tenants:run parses the arguments correctly * Fix code style (php-cs-fixer) * Fix PHPStan issue * remove unnecessary () --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Samuel Štancl <samuel.stancl@gmail.com>
This commit is contained in:
parent
f955b38e2b
commit
0e223e0484
4 changed files with 54 additions and 18 deletions
|
|
@ -389,6 +389,21 @@ test('run command works when sub command asks questions and accepts arguments',
|
|||
expect($user->email)->toBe('email@localhost');
|
||||
});
|
||||
|
||||
test('run command accepts arguments and options correctly', function() {
|
||||
$tenant = Tenant::create();
|
||||
$id = $tenant->getTenantKey();
|
||||
|
||||
// Use unquoted single-word arguments and quoted arguments with spaces
|
||||
pest()->artisan("tenants:run \"bar username 'email@localhost' adsfg123 'some Arg' --option='some option'\" --tenants=$id")
|
||||
->expectsOutputToContain("Tenant: $id.")
|
||||
->expectsOutput("Name: username")
|
||||
->expectsOutput("Email: email@localhost")
|
||||
->expectsOutput("Password: adsfg123")
|
||||
->expectsOutput("Argument: some Arg")
|
||||
->expectsOutput("Option: some option")
|
||||
->assertExitCode(0);
|
||||
});
|
||||
|
||||
test('migrate fresh command only deletes tenant databases if drop_tenant_databases_on_migrate_fresh is true', function (bool $dropTenantDBsOnMigrateFresh) {
|
||||
Event::listen(DeletingTenant::class,
|
||||
JobPipeline::make([DeleteDomains::class])->send(function (DeletingTenant $event) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue