mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-12 11:14:04 +00:00
Cloning: improve type annotations, add cloneRoutes() for convenience
This commit is contained in:
parent
197513dd84
commit
6ef4b91744
2 changed files with 60 additions and 6 deletions
|
|
@ -464,3 +464,14 @@ test('addTenantMiddleware can be used to specify the tenant middleware for the c
|
|||
expect($cloned->getDomain())->toBe('foo.localhost');
|
||||
expect(tenancy()->getRouteMiddleware($cloned))->toBe([InitializeTenancyByDomain::class]);
|
||||
});
|
||||
|
||||
test('cloneRoutes can be used to clone multiple routes', function () {
|
||||
RouteFacade::get('/foo', fn () => true)->name('foo');
|
||||
$bar = RouteFacade::get('/bar', fn () => true)->name('bar');
|
||||
RouteFacade::get('/baz', fn () => true)->name('baz');
|
||||
|
||||
CloneRoutesAsTenant::make()->cloneRoutes(['foo', $bar])->handle();
|
||||
expect(collect(RouteFacade::getRoutes()->get())->map->getName())->toContain('tenant.foo');
|
||||
expect(collect(RouteFacade::getRoutes()->get())->map->getName())->toContain('tenant.bar');
|
||||
expect(collect(RouteFacade::getRoutes()->get())->map->getName())->not()->toContain('tenant.baz');
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue