mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-12 12:24:04 +00:00
Refactor more old code and get tests to pass
This commit is contained in:
parent
c5377a16f7
commit
c32f229dd5
72 changed files with 425 additions and 531 deletions
|
|
@ -4,32 +4,39 @@ declare(strict_types=1);
|
|||
|
||||
namespace Stancl\Tenancy\Tests\Features;
|
||||
|
||||
use Illuminate\Support\Facades\Event;
|
||||
use Stancl\Tenancy\Database\Models\Tenant;
|
||||
use Stancl\Tenancy\Events\TenancyEnded;
|
||||
use Stancl\Tenancy\Events\TenancyInitialized;
|
||||
use Stancl\Tenancy\Features\TenantConfig;
|
||||
use Stancl\Tenancy\Listeners\BootstrapTenancy;
|
||||
use Stancl\Tenancy\Listeners\RevertToCentralContext;
|
||||
use Stancl\Tenancy\Tests\TestCase;
|
||||
|
||||
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.features' => [TenantConfig::class],
|
||||
'tenancy.bootstrappers' => [],
|
||||
]);
|
||||
Event::listen(TenancyInitialized::class, BootstrapTenancy::class);
|
||||
Event::listen(TenancyEnded::class, RevertToCentralContext::class);
|
||||
|
||||
TenantConfig::$storageToConfigMap = [
|
||||
'paypal_api_public' => 'services.paypal.public',
|
||||
'paypal_api_private' => 'services.paypal.private',
|
||||
];
|
||||
|
||||
tenancy()->create('foo.localhost', [
|
||||
$tenant = Tenant::create([
|
||||
'paypal_api_public' => 'foo',
|
||||
'paypal_api_private' => 'bar',
|
||||
]);
|
||||
|
||||
tenancy()->init('foo.localhost');
|
||||
tenancy()->initialize($tenant);
|
||||
$this->assertSame(['public' => 'foo', 'private' => 'bar'], config('services.paypal'));
|
||||
|
||||
tenancy()->end();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue