1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2025-12-12 19:54:03 +00:00

Disable cache tagging by default, add CacheTagBootstrapper

This commit is contained in:
lukinovec 2023-04-11 14:28:28 +02:00
parent 5849afa4c8
commit 7ebfc375d6
5 changed files with 31 additions and 12 deletions

View file

@ -7,7 +7,6 @@ use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\URL;
use Stancl\JobPipeline\JobPipeline;
use Illuminate\Support\Facades\File;
use Stancl\Tenancy\Bootstrappers\PrefixCacheTenancyBootstrapper;
use Stancl\Tenancy\Tests\Etc\Tenant;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\Event;
@ -29,6 +28,7 @@ use Stancl\Tenancy\Listeners\BootstrapTenancy;
use Stancl\Tenancy\Tests\Etc\TestingBroadcaster;
use Stancl\Tenancy\Listeners\DeleteTenantStorage;
use Stancl\Tenancy\Listeners\RevertToCentralContext;
use Stancl\Tenancy\Bootstrappers\CacheTagBootstrapper;
use Stancl\Tenancy\Bootstrappers\UrlTenancyBootstrapper;
use Stancl\Tenancy\Bootstrappers\MailTenancyBootstrapper;
use Stancl\Tenancy\Bootstrappers\RedisTenancyBootstrapper;
@ -36,7 +36,6 @@ use Stancl\Tenancy\Middleware\InitializeTenancyBySubdomain;
use Stancl\Tenancy\Bootstrappers\DatabaseTenancyBootstrapper;
use Stancl\Tenancy\Bootstrappers\BroadcastTenancyBootstrapper;
use Stancl\Tenancy\Bootstrappers\FilesystemTenancyBootstrapper;
use Stancl\Tenancy\CacheManager;
beforeEach(function () {
$this->mockConsoleOutput = false;
@ -84,11 +83,9 @@ test('database data is separated', function () {
});
test('cache data is separated', function () {
CacheManager::$addTags = true;
config([
'tenancy.bootstrappers' => [
PrefixCacheTenancyBootstrapper::class,
CacheTagBootstrapper::class,
],
'cache.default' => 'redis',
]);

View file

@ -2,16 +2,15 @@
declare(strict_types=1);
use Stancl\Tenancy\CacheManager;
use Stancl\Tenancy\Tests\Etc\Tenant;
use Illuminate\Support\Facades\Event;
use Stancl\Tenancy\Events\TenancyInitialized;
use Stancl\Tenancy\Listeners\BootstrapTenancy;
use Stancl\Tenancy\Bootstrappers\CacheTagBootstrapper;
beforeEach(function () {
config(['tenancy.bootstrappers' => []]);
config(['tenancy.bootstrappers' => [CacheTagBootstrapper::class]]);
CacheManager::$addTags = true;
Event::listen(TenancyInitialized::class, BootstrapTenancy::class);
});

View file

@ -2,16 +2,17 @@
declare(strict_types=1);
use Stancl\Tenancy\Tests\Etc\Tenant;
use Illuminate\Support\Facades\Event;
use Stancl\Tenancy\Events\TenancyEnded;
use Stancl\Tenancy\Events\TenancyInitialized;
use Stancl\Tenancy\Facades\GlobalCache;
use Stancl\Tenancy\Events\TenancyInitialized;
use Stancl\Tenancy\Listeners\BootstrapTenancy;
use Stancl\Tenancy\Listeners\RevertToCentralContext;
use Stancl\Tenancy\Tests\Etc\Tenant;
use Stancl\Tenancy\Bootstrappers\CacheTagBootstrapper;
beforeEach(function () {
config(['tenancy.bootstrappers' => []]);
config(['tenancy.bootstrappers' => [CacheTagBootstrapper::class]]);
Event::listen(TenancyInitialized::class, BootstrapTenancy::class);
Event::listen(TenancyEnded::class, RevertToCentralContext::class);