mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-12 19:14:04 +00:00
Data cache test
This commit is contained in:
parent
0fe2d2de87
commit
9892c3afc7
1 changed files with 33 additions and 0 deletions
33
tests/TenantClassTest.php
Normal file
33
tests/TenantClassTest.php
Normal file
|
|
@ -0,0 +1,33 @@
|
||||||
|
<?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();
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue