mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-12 11:14:04 +00:00
Add cookie option on Initialize Tenancy by Request identification (#980)
* Add cookie option on Initialize Tenancy by Request identification * add cookie property
This commit is contained in:
parent
693e00b9be
commit
05f1b2d6f5
2 changed files with 25 additions and 10 deletions
|
|
@ -20,19 +20,18 @@ beforeEach(function () {
|
|||
|
||||
afterEach(function () {
|
||||
InitializeTenancyByRequestData::$header = 'X-Tenant';
|
||||
InitializeTenancyByRequestData::$cookie = 'X-Tenant';
|
||||
InitializeTenancyByRequestData::$queryParameter = 'tenant';
|
||||
});
|
||||
|
||||
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 +39,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::$cookie = 'X-Tenant';
|
||||
$tenant = Tenant::create();
|
||||
|
||||
$this
|
||||
->withoutExceptionHandling()
|
||||
->withUnencryptedCookie('X-Tenant', $tenant->id)
|
||||
->get('test',)
|
||||
->assertSee($tenant->id);
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue