1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2025-12-12 12:54:05 +00:00

[2.x] Don't purge central connections (#189)

* Make sure central connections aren't ever purged

* Extract setDefaultConnection()

* Regression test w/ markTestIncomplete()

* Apply fixes from StyleCI
This commit is contained in:
Samuel Štancl 2019-10-19 23:52:13 +02:00 committed by GitHub
parent c8a0a58df6
commit 479df83027
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 32 additions and 1 deletions

View file

@ -45,4 +45,21 @@ class DatabaseManagerTest extends TestCase
$this->assertSame('tenant', config('database.default'));
$this->assertSame('bar', config('database.connections.' . config('database.default') . '.foo'));
}
/** @test */
public function ending_tenancy_doesnt_purge_the_central_connection()
{
$this->markTestIncomplete('Seems like this only happens on MySQL?');
// regression test for https://github.com/stancl/tenancy/pull/189
// config(['tenancy.migrate_after_creation' => true]);
tenancy()->create(['foo.localhost']);
tenancy()->init('foo.localhost');
tenancy()->end();
$this->assertNotEmpty(tenancy()->all());
tenancy()->all()->each->delete();
}
}