1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-02-05 23:24:03 +00:00

Fix issue 521: Array input for --tenants

Tenancy for Laravel docs refer to using multiple `--tenants=<...> ` options when running a command for multiple tenants explicitly: https://tenancyforlaravel.com/docs/v3/console-commands

However, the command input is not defined correctly to receive arrays.
https://laravel.com/docs/7.x/artisan#input-arrays

This PR adds a failing test, fixes the issue and corrects a typo in the contributing readme.
This commit is contained in:
Dylan Harbour 2020-11-04 15:33:12 +02:00
parent f273ed4f1e
commit 9e2cb75351
3 changed files with 15 additions and 2 deletions

View file

@ -190,4 +190,17 @@ class CommandsTest extends TestCase
Artisan::call('tenants:migrate-fresh');
$this->assertFalse(DB::table('users')->exists());
}
/** @test */
public function run_command_with_array_of_tenants_works()
{
$tenantId1 = Tenant::create()->getTenantKey();
$tenantId2= Tenant::create()->getTenantKey();
Artisan::call('tenants:migrate-fresh');
$this->artisan("tenants:run foo --tenants=$tenantId1 --tenants=$tenantId2 --argument='a=foo' --option='b=bar' --option='c=xyz'")
->expectsOutput("Tenant: " . $tenantId1)
->expectsOutput("Tenant: " . $tenantId2);
}
}