1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-05-06 21:04:06 +00:00

Use toEqualCanonicalizing instead of toBe for custom creators

The order of the array items shouldn't matter.
This commit is contained in:
lukinovec 2026-04-15 11:20:59 +02:00
parent 7db486d1b9
commit d885659a16

View file

@ -171,19 +171,19 @@ test('tenant broadcast manager receives the custom driver creators of the centra
); );
// Current BroadcastManager instance has the original custom creators plus the newly registered testing-tenant1 creator // Current BroadcastManager instance has the original custom creators plus the newly registered testing-tenant1 creator
expect(array_keys(invade(app(BroadcastManager::class))->customCreators))->toBe([...$originalDrivers, 'testing-tenant1']); expect(array_keys(invade(app(BroadcastManager::class))->customCreators))->toEqualCanonicalizing([...$originalDrivers, 'testing-tenant1']);
tenancy()->initialize($tenant2); tenancy()->initialize($tenant2);
// Current BroadcastManager only has the original custom creators, // Current BroadcastManager only has the original custom creators,
// the creator added in the previous tenant's context doesn't persist. // the creator added in the previous tenant's context doesn't persist.
expect(array_keys(invade(app(BroadcastManager::class))->customCreators))->toBe($originalDrivers); expect(array_keys(invade(app(BroadcastManager::class))->customCreators))->toEqualCanonicalizing($originalDrivers);
tenancy()->end(); tenancy()->end();
// Ending tenancy reverts the BroadcastManager binding back to the original state, // Ending tenancy reverts the BroadcastManager binding back to the original state,
// the creator registered in the tenant context doesn't persist. // the creator registered in the tenant context doesn't persist.
expect(array_keys(invade(app(BroadcastManager::class))->customCreators))->toBe($originalDrivers); expect(array_keys(invade(app(BroadcastManager::class))->customCreators))->toEqualCanonicalizing($originalDrivers);
}); });
test('tenant broadcasters receive the channels from the broadcaster bound in central context', function(string $driver) { test('tenant broadcasters receive the channels from the broadcaster bound in central context', function(string $driver) {