mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 14:54:03 +00:00
Add tests for schema dump and schema load
This commit is contained in:
parent
43c6a7b99c
commit
3566882062
1 changed files with 32 additions and 0 deletions
|
|
@ -91,6 +91,38 @@ class CommandsTest extends TestCase
|
|||
$this->assertTrue(Schema::hasTable('users'));
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function migrate_command_loads_schema_state()
|
||||
{
|
||||
$tenant = Tenant::create();
|
||||
|
||||
$this->assertFalse(Schema::hasTable('schema_users'));
|
||||
$this->assertFalse(Schema::hasTable('users'));
|
||||
|
||||
Artisan::call('tenants:migrate --schema-path="tests/Etc/tenant-schema.dump"');
|
||||
|
||||
$this->assertFalse(Schema::hasTable('schema_users'));
|
||||
$this->assertFalse(Schema::hasTable('users'));
|
||||
|
||||
tenancy()->initialize($tenant);
|
||||
|
||||
// Check for both tables to see if missing migrations also get executed.
|
||||
$this->assertTrue(Schema::hasTable('schema_users'));
|
||||
$this->assertTrue(Schema::hasTable('users'));
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function dump_command_works()
|
||||
{
|
||||
$tenant = Tenant::create();
|
||||
Artisan::call('tenants:migrate');
|
||||
|
||||
tenancy()->initialize($tenant);
|
||||
|
||||
Artisan::call('tenants:dump --path="tests/Etc/tenant-schema-test.dump"');
|
||||
$this->assertFileExists('tests/Etc/tenant-schema-test.dump');
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function rollback_command_works()
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue