mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-06 00:34:05 +00:00
Add bootstrapper test
This commit is contained in:
parent
cc82d60903
commit
ab009d3679
1 changed files with 16 additions and 1 deletions
|
|
@ -343,6 +343,22 @@ test('BroadcastTenancyBootstrapper binds TenancyBroadcastManager to BroadcastMan
|
||||||
expect(app(BroadcastManager::class))->toBeInstanceOf(BroadcastManager::class);
|
expect(app(BroadcastManager::class))->toBeInstanceOf(BroadcastManager::class);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('bound broadcaster instance is the same before initializing tenancy and after ending it', function() {
|
||||||
|
config(['broadcasting.default' => 'null']);
|
||||||
|
TenancyBroadcastManager::$tenantBroadcasters[] = 'null';
|
||||||
|
|
||||||
|
$originalBroadcaster = app(BroadcasterContract::class);
|
||||||
|
|
||||||
|
tenancy()->initialize(Tenant::create());
|
||||||
|
|
||||||
|
// TenancyBroadcastManager binds new broadcaster
|
||||||
|
app(BroadcastManager::class)->driver();
|
||||||
|
|
||||||
|
tenancy()->end();
|
||||||
|
|
||||||
|
expect($originalBroadcaster)->toBe(app(BroadcasterContract::class));
|
||||||
|
});
|
||||||
|
|
||||||
test('BroadcastTenancyBootstrapper maps tenant broadcaster credentials to config as specified in the $credentialsMap property and reverts the config after ending tenancy', function() {
|
test('BroadcastTenancyBootstrapper maps tenant broadcaster credentials to config as specified in the $credentialsMap property and reverts the config after ending tenancy', function() {
|
||||||
config([
|
config([
|
||||||
'broadcasting.connections.testing.driver' => 'testing',
|
'broadcasting.connections.testing.driver' => 'testing',
|
||||||
|
|
@ -396,7 +412,6 @@ test('broadcasters are created with the correct credentials', function() {
|
||||||
|
|
||||||
expect(invade(app(BroadcastManager::class)->driver())->message)->toBe($tenantMessage);
|
expect(invade(app(BroadcastManager::class)->driver())->message)->toBe($tenantMessage);
|
||||||
|
|
||||||
tenancy()->end();
|
|
||||||
tenancy()->initialize($tenant2);
|
tenancy()->initialize($tenant2);
|
||||||
$registerTestingBroadcaster();
|
$registerTestingBroadcaster();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue