From a346ec450eaad4c2f5bfd395bb4f526eeed33d42 Mon Sep 17 00:00:00 2001 From: lukinovec Date: Fri, 30 Sep 2022 11:10:03 +0200 Subject: [PATCH] Remove tenant ordering --- src/Commands/Run.php | 8 -------- tests/CommandsTest.php | 5 +++-- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/src/Commands/Run.php b/src/Commands/Run.php index 4a9cd3f4..b28bf07d 100644 --- a/src/Commands/Run.php +++ b/src/Commands/Run.php @@ -29,14 +29,6 @@ class Run extends Command $argvInput = $this->ArgvInput(); $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) { $this->line("Tenant: {$tenant->getTenantKey()}"); diff --git a/tests/CommandsTest.php b/tests/CommandsTest.php index f7785bf2..d28815f5 100644 --- a/tests/CommandsTest.php +++ b/tests/CommandsTest.php @@ -201,8 +201,9 @@ test('run command with array of tenants works', function () { Artisan::call('tenants:migrate-fresh'); pest()->artisan("tenants:run --tenants=$tenantId1 --tenants=$tenantId2 'foo foo --b=bar --c=xyz'") - ->expectsOutput('Tenant: ' . $tenantId1) - ->expectsOutput('Tenant: ' . $tenantId2); + ->expectsOutputToContain('Tenant: ' . $tenantId1) + ->expectsOutputToContain('Tenant: ' . $tenantId2) + ->assertExitCode(0); }); test('link command works', function() {