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

Add cookie option on Initialize Tenancy by Request identification

This commit is contained in:
Abrar Ahmad 2022-10-17 13:56:02 +05:00
parent 42dab2985a
commit 9eab5216b9
2 changed files with 23 additions and 10 deletions

View file

@ -26,13 +26,11 @@ afterEach(function () {
test('header identification works', function () {
InitializeTenancyByRequestData::$header = 'X-Tenant';
$tenant = Tenant::create();
$tenant2 = Tenant::create();
$this
->withoutExceptionHandling()
->get('test', [
'X-Tenant' => $tenant->id,
])
->withHeader('X-Tenant', $tenant->id)
->get('test')
->assertSee($tenant->id);
});
@ -40,10 +38,20 @@ test('query parameter identification works', function () {
InitializeTenancyByRequestData::$queryParameter = 'tenant';
$tenant = Tenant::create();
$tenant2 = Tenant::create();
$this
->withoutExceptionHandling()
->get('test?tenant=' . $tenant->id)
->assertSee($tenant->id);
});
test('cookie identification works', function () {
InitializeTenancyByRequestData::$header = 'X-Tenant';
$tenant = Tenant::create();
$this
->withoutExceptionHandling()
->withUnencryptedCookie('X-Tenant', $tenant->id)
->get('test',)
->assertSee($tenant->id);
});