mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 13:34:04 +00:00
use initialize() twice without end()ing tenancy to assert that previousConnection logic works correctly
This commit is contained in:
parent
989e2368ca
commit
395d8597bb
1 changed files with 4 additions and 2 deletions
|
|
@ -24,15 +24,17 @@ beforeEach(function () {
|
|||
|
||||
test('batch repository is set to tenant connection and reverted', function () {
|
||||
$tenant = Tenant::create();
|
||||
$tenant2 = Tenant::create();
|
||||
|
||||
expect(getBatchRepositoryConnectionName())->toBe('central');
|
||||
|
||||
tenancy()->initialize($tenant);
|
||||
|
||||
expect(getBatchRepositoryConnectionName())->toBe('tenant');
|
||||
|
||||
tenancy()->initialize($tenant2);
|
||||
expect(getBatchRepositoryConnectionName())->toBe('tenant');
|
||||
|
||||
tenancy()->end();
|
||||
|
||||
expect(getBatchRepositoryConnectionName())->toBe('central');
|
||||
})->skip(fn() => version_compare(app()->version(), '8.0', '<'), 'Job batches are only supported in Laravel 8+');
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue