mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-12 17:24:03 +00:00
Fix #998, centralize config used by BelongsToTenant and HasDomains
This commit is contained in:
parent
942d79cbd7
commit
dd0f03f742
14 changed files with 41 additions and 32 deletions
|
|
@ -16,7 +16,7 @@ beforeEach(function () {
|
|||
});
|
||||
});
|
||||
|
||||
config(['tenancy.tenant_model' => CombinedTenant::class]);
|
||||
config(['tenancy.models.tenant' => CombinedTenant::class]);
|
||||
});
|
||||
|
||||
test('tenant can be identified by subdomain', function () {
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ use Stancl\Tenancy\Database\Concerns\HasDomains;
|
|||
use Stancl\Tenancy\Jobs\DeleteDomains;
|
||||
|
||||
beforeEach(function () {
|
||||
config(['tenancy.tenant_model' => DatabaseAndDomainTenant::class]);
|
||||
config(['tenancy.models.tenant' => DatabaseAndDomainTenant::class]);
|
||||
});
|
||||
|
||||
test('job delete domains successfully', function (){
|
||||
|
|
@ -29,4 +29,4 @@ test('job delete domains successfully', function (){
|
|||
class DatabaseAndDomainTenant extends \Stancl\Tenancy\Tests\Etc\Tenant
|
||||
{
|
||||
use HasDomains;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ beforeEach(function () {
|
|||
});
|
||||
});
|
||||
|
||||
config(['tenancy.tenant_model' => DomainTenant::class]);
|
||||
config(['tenancy.models.tenant' => DomainTenant::class]);
|
||||
});
|
||||
|
||||
test('tenant can be identified using hostname', function () {
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ beforeEach(function () {
|
|||
$table->foreign('post_id')->references('id')->on('posts')->onUpdate('cascade')->onDelete('cascade');
|
||||
});
|
||||
|
||||
config(['tenancy.tenant_model' => Tenant::class]);
|
||||
config(['tenancy.models.tenant' => Tenant::class]);
|
||||
});
|
||||
|
||||
test('primary models are scoped to the current tenant', function () {
|
||||
|
|
@ -142,7 +142,7 @@ test('tenant id is not auto added when creating primary resources in central con
|
|||
});
|
||||
|
||||
test('tenant id column name can be customized', function () {
|
||||
config(['tenancy.single_db.tenant_id_column' => 'team_id']);
|
||||
config(['tenancy.models.tenant_key_column' => 'team_id']);
|
||||
|
||||
Schema::drop('comments');
|
||||
Schema::drop('posts');
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ beforeEach(function () {
|
|||
});
|
||||
});
|
||||
|
||||
config(['tenancy.tenant_model' => SubdomainTenant::class]);
|
||||
config(['tenancy.models.tenant' => SubdomainTenant::class]);
|
||||
});
|
||||
|
||||
test('tenant can be identified by subdomain', function () {
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ test('current tenant can be resolved from service container using typehint', fun
|
|||
});
|
||||
|
||||
test('id is generated when no id is supplied', function () {
|
||||
config(['tenancy.id_generator' => UUIDGenerator::class]);
|
||||
config(['tenancy.models.id_generator' => UUIDGenerator::class]);
|
||||
|
||||
$this->mock(UUIDGenerator::class, function ($mock) {
|
||||
return $mock->shouldReceive('generate')->once();
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ abstract class TestCase extends \Orchestra\Testbench\TestCase
|
|||
'central' => true,
|
||||
],
|
||||
'tenancy.seeder_parameters' => [],
|
||||
'tenancy.tenant_model' => Tenant::class, // Use test tenant w/ DBs & domains
|
||||
'tenancy.models.tenant' => Tenant::class, // Use test tenant w/ DBs & domains
|
||||
]);
|
||||
|
||||
$app->singleton(RedisTenancyBootstrapper::class); // todo (Samuel) use proper approach eg config for singleton registration
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue