mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-12 22:54:03 +00:00
Rename CacheAction to CacheService
This commit is contained in:
parent
974414a12d
commit
4c33df1aa5
2 changed files with 6 additions and 6 deletions
|
|
@ -6,7 +6,7 @@ namespace Stancl\Tenancy\Tests\Etc;
|
||||||
|
|
||||||
use Illuminate\Cache\Repository;
|
use Illuminate\Cache\Repository;
|
||||||
|
|
||||||
class CacheAction // todo renamed to CacheService
|
class CacheService
|
||||||
{
|
{
|
||||||
public function __construct(
|
public function __construct(
|
||||||
protected Repository $cache
|
protected Repository $cache
|
||||||
|
|
@ -8,7 +8,7 @@ use Stancl\Tenancy\Events\TenancyEnded;
|
||||||
use Stancl\Tenancy\Events\TenancyInitialized;
|
use Stancl\Tenancy\Events\TenancyInitialized;
|
||||||
use Stancl\Tenancy\Listeners\BootstrapTenancy;
|
use Stancl\Tenancy\Listeners\BootstrapTenancy;
|
||||||
use Stancl\Tenancy\Listeners\RevertToCentralContext;
|
use Stancl\Tenancy\Listeners\RevertToCentralContext;
|
||||||
use Stancl\Tenancy\Tests\Etc\CacheAction;
|
use Stancl\Tenancy\Tests\Etc\CacheService;
|
||||||
|
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
config([
|
config([
|
||||||
|
|
@ -124,9 +124,9 @@ test('cache base prefix is customizable', function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
test('prefix separate cache well enough using CacheManager dependency injection', function () {
|
test('prefix separate cache well enough using CacheManager dependency injection', function () {
|
||||||
$this->app->singleton(CacheAction::class);
|
$this->app->singleton(CacheService::class);
|
||||||
|
|
||||||
app()->make(CacheAction::class)->handle();
|
app()->make(CacheService::class)->handle();
|
||||||
|
|
||||||
expect(cache('key'))->toBe('central-value');
|
expect(cache('key'))->toBe('central-value');
|
||||||
|
|
||||||
|
|
@ -135,13 +135,13 @@ test('prefix separate cache well enough using CacheManager dependency injection'
|
||||||
tenancy()->initialize($tenant1);
|
tenancy()->initialize($tenant1);
|
||||||
|
|
||||||
expect(cache('key'))->toBeNull();
|
expect(cache('key'))->toBeNull();
|
||||||
app()->make(CacheAction::class)->handle();
|
app()->make(CacheService::class)->handle();
|
||||||
expect(cache('key'))->toBe($tenant1->getTenantKey());
|
expect(cache('key'))->toBe($tenant1->getTenantKey());
|
||||||
|
|
||||||
tenancy()->initialize($tenant2);
|
tenancy()->initialize($tenant2);
|
||||||
|
|
||||||
expect(cache('key'))->toBeNull();
|
expect(cache('key'))->toBeNull();
|
||||||
app()->make(CacheAction::class)->handle();
|
app()->make(CacheService::class)->handle();
|
||||||
expect(cache('key'))->toBe($tenant2->getTenantKey());
|
expect(cache('key'))->toBe($tenant2->getTenantKey());
|
||||||
|
|
||||||
tenancy()->end();
|
tenancy()->end();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue