mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 20:34:03 +00:00
set tenant as default url parameter
This commit is contained in:
parent
eade69c3f4
commit
856d8b0b02
2 changed files with 27 additions and 1 deletions
|
|
@ -18,7 +18,11 @@ beforeEach(function () {
|
|||
], function () {
|
||||
Route::get('/foo/{a}/{b}', function ($a, $b) {
|
||||
return "$a + $b";
|
||||
});
|
||||
})->name('foo');
|
||||
|
||||
Route::get('/baz/{a}/{b}', function ($a, $b) {
|
||||
return "$a - $b";
|
||||
})->name('baz');
|
||||
});
|
||||
});
|
||||
|
||||
|
|
@ -123,3 +127,17 @@ test('tenant parameter name can be customized', function () {
|
|||
->withoutExceptionHandling()
|
||||
->get('/acme/foo/abc/xyz');
|
||||
});
|
||||
|
||||
test('tenant set as a default parameter for the URLs', function () {
|
||||
Tenant::create([
|
||||
'id' => 'acme',
|
||||
]);
|
||||
|
||||
expect(tenancy()->initialized)->toBeFalse();
|
||||
|
||||
pest()->get(route('foo', ['tenant' => 'acme', 'a' => 1, 'b' => 2]));
|
||||
|
||||
expect(tenancy()->initialized)->toBeTrue();
|
||||
expect(tenant('id'))->toBe('acme');
|
||||
pest()->get(route('baz', ['a' => 1, 'b' => 2]))->assertOk(); // Assert route don't need tenant parameter
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue