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

add --only-selected option for tenants:migrate command

This commit is contained in:
IWT 2020-11-19 20:15:59 +07:00
parent 126afcd0dd
commit 5ef225762f
4 changed files with 51 additions and 1 deletions

View file

@ -91,6 +91,25 @@ class CommandsTest extends TestCase
$this->assertTrue(Schema::hasTable('users'));
}
/** @test */
public function migrate_command_works_with_only_selected_tenants_option()
{
$tenants = [Tenant::create(), Tenant::create()];
config()->set('tenancy.migration_filter_tenants_method', [Stancl\Tenancy\Tests\Etc\Tenant::class, 'getTheFirstOne']);
Artisan::call('tenants:migrate', [
'--tenants' => [$tenants[0]['id'], $tenants[1]['id']],
'--only-selected' => true
]);
tenancy()->initialize($tenants[0]);
$this->assertTrue(Schema::hasTable('users'));
tenancy()->initialize($tenants[1]);
$this->assertFalse(Schema::hasTable('users'));
}
/** @test */
public function rollback_command_works()
{