mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 10:14:04 +00:00
Add tests & config keys
This commit is contained in:
parent
c81218a993
commit
13ea04e7f5
2 changed files with 39 additions and 0 deletions
|
|
@ -79,9 +79,13 @@ return [
|
|||
// Features are classes that provide additional functionality
|
||||
// not needed for tenancy to be bootstrapped. They are run
|
||||
// regardless of whether tenancy has been initialized.
|
||||
Stancl\Tenancy\Features\TenantConfig::class,
|
||||
Stancl\Tenancy\Features\TelescopeTags::class,
|
||||
Stancl\Tenancy\Features\TenantRedirect::class,
|
||||
],
|
||||
'storage_to_config_map' => [
|
||||
// 'paypal_api_key' => 'services.paypal.api_key',
|
||||
],
|
||||
'home_url' => '/app',
|
||||
'migrate_after_creation' => false, // run migrations after creating a tenant
|
||||
'delete_database_after_tenant_deletion' => false, // delete the tenant's database after deleting the tenant
|
||||
|
|
|
|||
35
tests/TenantConfigTest.php
Normal file
35
tests/TenantConfigTest.php
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
|
||||
namespace Stancl\Tenancy\Tests;
|
||||
|
||||
use Stancl\Tenancy\Tenant;
|
||||
|
||||
class TenantConfigTest extends TestCase
|
||||
{
|
||||
public $autoInitTenancy = false;
|
||||
public $autoCreateTenant = false;
|
||||
|
||||
/** @test */
|
||||
public function config_is_merged_and_removed()
|
||||
{
|
||||
$this->assertSame(null, config('services.paypal'));
|
||||
config(['tenancy.storage_to_config_map' => [
|
||||
'paypal_api_public' => 'services.paypal.public',
|
||||
'paypal_api_private' => 'services.paypal.private',
|
||||
]]);
|
||||
|
||||
tenancy()->create('foo.localhost', [
|
||||
'paypal_api_public' => 'foo',
|
||||
'paypal_api_private' => 'bar',
|
||||
]);
|
||||
|
||||
tenancy()->init('foo.localhost');
|
||||
$this->assertSame(['public' => 'foo', 'private' => 'bar'], config('services.paypal'));
|
||||
|
||||
tenancy()->end();
|
||||
$this->assertSame([
|
||||
'public' => null,
|
||||
'private' => null,
|
||||
], config('services.paypal'));
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue