mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-12 19:34:04 +00:00
prefix cache bootstrapper and tests
This commit is contained in:
parent
898d6c5d3b
commit
d6da626f73
4 changed files with 32 additions and 40 deletions
|
|
@ -6,6 +6,7 @@ use Illuminate\Support\Str;
|
|||
use Illuminate\Support\Facades\DB;
|
||||
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;
|
||||
|
|
@ -73,11 +74,9 @@ test('database data is separated', function () {
|
|||
expect(DB::table('users')->first()->name)->toBe('Foo');
|
||||
});
|
||||
|
||||
test('cache data is separated', function () {
|
||||
test('cache data is separated', function (string $bootstrapper) {
|
||||
config([
|
||||
'tenancy.bootstrappers' => [
|
||||
CacheTenancyBootstrapper::class,
|
||||
],
|
||||
'tenancy.bootstrappers' => [$bootstrapper],
|
||||
'cache.default' => 'redis',
|
||||
]);
|
||||
|
||||
|
|
@ -112,7 +111,10 @@ test('cache data is separated', function () {
|
|||
|
||||
// Asset central is still the same
|
||||
expect(Cache::get('foo'))->toBe('central');
|
||||
});
|
||||
})->with([
|
||||
'CacheTenancyBootstrapper' => CacheTenancyBootstrapper::class,
|
||||
'PrefixCacheTenancyBootstrapper' => PrefixCacheTenancyBootstrapper::class,
|
||||
]);
|
||||
|
||||
test('redis data is separated', function () {
|
||||
config(['tenancy.bootstrappers' => [
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ use Dotenv\Dotenv;
|
|||
use Illuminate\Foundation\Application;
|
||||
use Illuminate\Support\Facades\Redis;
|
||||
use PDO;
|
||||
use Stancl\Tenancy\Bootstrappers\BatchTenancyBootstrapper;
|
||||
use Stancl\Tenancy\Bootstrappers\PrefixCacheTenancyBootstrapper;
|
||||
use Stancl\Tenancy\Bootstrappers\RedisTenancyBootstrapper;
|
||||
use Stancl\Tenancy\Facades\GlobalCache;
|
||||
use Stancl\Tenancy\Facades\Tenancy;
|
||||
|
|
@ -113,6 +113,7 @@ abstract class TestCase extends \Orchestra\Testbench\TestCase
|
|||
]);
|
||||
|
||||
$app->singleton(RedisTenancyBootstrapper::class); // todo (Samuel) use proper approach eg config for singleton registration
|
||||
$app->singleton(PrefixCacheTenancyBootstrapper::class); // todo (Samuel) use proper approach eg config for singleton registration
|
||||
}
|
||||
|
||||
protected function getPackageProviders($app)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue