Skip to content

Commit 1f2a017

Browse files
committed
Add test for tenants:migrate-fresh -v
1 parent af1231f commit 1f2a017

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

tests/CommandsTest.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,21 @@
366366
expect(DB::table('users')->exists())->toBeFalse();
367367
});
368368

369+
test('migrate fresh command only shows migration output when run with the verbose option', function () {
370+
$tenant = Tenant::create();
371+
372+
// pest()->artisan()->expectsOutput() cannot observe the output suppression,
373+
// so use Artisan::call() + Artisan::output() instead.
374+
375+
// By default the underlying tenants:migrate output is suppressed
376+
Artisan::call('tenants:migrate-fresh');
377+
expect(Artisan::output())->not()->toContain('Migrating tenant ' . $tenant->getTenantKey());
378+
379+
// Underlying tenants:migrate output is shown when the verbose option is passed
380+
Artisan::call('tenants:migrate-fresh -v');
381+
expect(Artisan::output())->toContain('Migrating tenant ' . $tenant->getTenantKey());
382+
});
383+
369384
test('migrate fresh command respects force option in production', function () {
370385
// Set environment to production
371386
app()->detectEnvironment(fn() => 'production');

0 commit comments

Comments
 (0)