mirror of
https://github.com/archtechx/tenancy.git
synced 2026-08-06 09:34:03 +00:00
Retrieve the re-registered channel closure to assert what tenant_channel() actually stored
https://github.com/archtechx/tenancy/pull/1448#discussion_r3561157859
This commit is contained in:
parent
af14d403c5
commit
b8fddf8a57
1 changed files with 9 additions and 3 deletions
|
|
@ -208,10 +208,16 @@ test('broadcasting channel helpers register channels correctly', function() {
|
|||
return User::firstWhere('name', $userName)?->is($user) ?? false;
|
||||
});
|
||||
|
||||
expect($tenantChannelClosure)->not()->toBe($centralChannelClosure);
|
||||
// Retrieve the stored closure to verify that re-registering the channel replaced it
|
||||
// (asserting on $tenantChannelClosure wouldn't tell us what tenant_channel() actually stored)
|
||||
$reregisteredTenantChannelClosure = $getChannels()->first(fn ($closure, $name) => $name === "{tenant}.$channelName");
|
||||
|
||||
expect($tenantChannelClosure($centralUser, $tenant->getTenantKey(), $centralUser->name))->toBeTrue();
|
||||
expect($tenantChannelClosure($centralUser, $tenant->getTenantKey(), $tenantUser->name))->toBeFalse();
|
||||
expect($reregisteredTenantChannelClosure)
|
||||
->toBe($tenantChannelClosure)
|
||||
->not()->toBe($centralChannelClosure);
|
||||
|
||||
expect($reregisteredTenantChannelClosure($centralUser, $tenant->getTenantKey(), $centralUser->name))->toBeTrue();
|
||||
expect($reregisteredTenantChannelClosure($centralUser, $tenant->getTenantKey(), $tenantUser->name))->toBeFalse();
|
||||
|
||||
tenancy()->initialize($tenant);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue