mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 19:54:04 +00:00
Remove tenant ordering
This commit is contained in:
parent
b211cf1caf
commit
a346ec450e
2 changed files with 3 additions and 10 deletions
|
|
@ -29,14 +29,6 @@ class Run extends Command
|
||||||
$argvInput = $this->ArgvInput();
|
$argvInput = $this->ArgvInput();
|
||||||
$tenants = $this->getTenants();
|
$tenants = $this->getTenants();
|
||||||
|
|
||||||
if ($this->option('tenants')) {
|
|
||||||
// $this->getTenants() doesn't return tenants in the same order as the tenants passed in the tenants option
|
|
||||||
// Map the passed tenant keys to the fetched tenant models to correct the order
|
|
||||||
$tenants = array_map(function (string $tenantKey) use ($tenants) {
|
|
||||||
return $tenants->filter(fn (Tenant $tenant) => $tenant->getTenantKey() === $tenantKey)->first();
|
|
||||||
}, $this->option('tenants'));
|
|
||||||
}
|
|
||||||
|
|
||||||
tenancy()->runForMultiple($tenants, function ($tenant) use ($argvInput) {
|
tenancy()->runForMultiple($tenants, function ($tenant) use ($argvInput) {
|
||||||
$this->line("Tenant: {$tenant->getTenantKey()}");
|
$this->line("Tenant: {$tenant->getTenantKey()}");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -201,8 +201,9 @@ test('run command with array of tenants works', function () {
|
||||||
Artisan::call('tenants:migrate-fresh');
|
Artisan::call('tenants:migrate-fresh');
|
||||||
|
|
||||||
pest()->artisan("tenants:run --tenants=$tenantId1 --tenants=$tenantId2 'foo foo --b=bar --c=xyz'")
|
pest()->artisan("tenants:run --tenants=$tenantId1 --tenants=$tenantId2 'foo foo --b=bar --c=xyz'")
|
||||||
->expectsOutput('Tenant: ' . $tenantId1)
|
->expectsOutputToContain('Tenant: ' . $tenantId1)
|
||||||
->expectsOutput('Tenant: ' . $tenantId2);
|
->expectsOutputToContain('Tenant: ' . $tenantId2)
|
||||||
|
->assertExitCode(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('link command works', function() {
|
test('link command works', function() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue