1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2025-12-12 11:34:03 +00:00
tenancy/tests/TenantClassTest.php
2019-09-20 17:56:22 +02:00

33 lines
No EOL
913 B
PHP

<?php
namespace Stancl\Tenancy\Tests;
use Mockery;
use Stancl\Tenancy\Contracts\StorageDriver;
use Stancl\Tenancy\Tenant;
class TenantClassTest extends TestCase
{
public $autoInitTenancy = false;
public $autoCreateTenant = false;
/** @test */
public function data_cache_works_properly()
{
$spy = Mockery::spy(config('tenancy.storage_driver'))->makePartial();
$this->instance(StorageDriver::class, $spy);
$tenant = Tenant::create(['foo.localhost'], ['foo' => 'bar']);
$this->assertSame('bar', $tenant->data['foo']);
$tenant->put('abc', 'xyz');
$this->assertSame('xyz', $tenant->data['abc']);
$tenant->put(['aaa' => 'bbb', 'ccc' => 'ddd']);
$this->assertSame('bbb', $tenant->data['aaa']);
$this->assertSame('ddd', $tenant->data['ccc']);
$spy->shouldNotHaveReceived('get');
Mockery::close();
}
}