1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-06-21 01:34:04 +00:00

Add test for tenants:migrate-fresh -v

This commit is contained in:
lukinovec 2026-06-13 08:28:01 +02:00
parent af1231f025
commit 1f2a017a41

View file

@ -366,6 +366,21 @@ test('migrate fresh command works', function () {
expect(DB::table('users')->exists())->toBeFalse();
});
test('migrate fresh command only shows migration output when run with the verbose option', function () {
$tenant = Tenant::create();
// pest()->artisan()->expectsOutput() cannot observe the output suppression,
// so use Artisan::call() + Artisan::output() instead.
// By default the underlying tenants:migrate output is suppressed
Artisan::call('tenants:migrate-fresh');
expect(Artisan::output())->not()->toContain('Migrating tenant ' . $tenant->getTenantKey());
// Underlying tenants:migrate output is shown when the verbose option is passed
Artisan::call('tenants:migrate-fresh -v');
expect(Artisan::output())->toContain('Migrating tenant ' . $tenant->getTenantKey());
});
test('migrate fresh command respects force option in production', function () {
// Set environment to production
app()->detectEnvironment(fn() => 'production');