1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2025-12-13 03:14:03 +00:00

Add identification section to config, refactor static properties

This commit is contained in:
Samuel Štancl 2022-10-01 20:01:18 +02:00
parent e5bc8ddb77
commit ccaba05272
17 changed files with 153 additions and 97 deletions

View file

@ -10,8 +10,6 @@ use Stancl\Tenancy\Resolvers\PathTenantResolver;
use Stancl\Tenancy\Tests\Etc\Tenant;
beforeEach(function () {
PathTenantResolver::$tenantParameterName = 'tenant';
Route::group([
'prefix' => '/{tenant}',
'middleware' => InitializeTenancyByPath::class,
@ -26,11 +24,6 @@ beforeEach(function () {
});
});
afterEach(function () {
// Global state cleanup
PathTenantResolver::$tenantParameterName = 'tenant';
});
test('tenant can be identified by path', function () {
Tenant::create([
'id' => 'acme',
@ -101,7 +94,7 @@ test('an exception is thrown when the routes first parameter is not tenant', fun
});
test('tenant parameter name can be customized', function () {
PathTenantResolver::$tenantParameterName = 'team';
config(['tenancy.identification.resolvers.' . PathTenantResolver::class . '.tenant_parameter_name' => 'team']);
Route::group([
'prefix' => '/{team}',