Skip to content

Commit 251f3fa

Browse files
committed
wip
1 parent 5091e64 commit 251f3fa

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

tests/src/CacheProfiles/CacheAllSuccessful.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
<?php
22

33
use Foxws\UserCache\CacheProfiles\CacheAllSuccessful;
4+
use Foxws\UserCache\Tests\Models\User;
45

6+
use function PHPUnit\Framework\assertEquals;
57
use function PHPUnit\Framework\assertTrue;
68

79
beforeEach(function () {
@@ -12,3 +14,12 @@
1214
assertTrue($this->cacheProfile->shouldCacheValue('foo'));
1315
assertTrue($this->cacheProfile->shouldCacheValue(['foo', 'bar']));
1416
});
17+
18+
it('will use the id of the logged in user to differentiate caches', function () {
19+
assertEquals('', $this->cacheProfile->useCacheNameSuffix('foo'));
20+
21+
User::all()->map(function ($user) {
22+
auth()->login(User::find($user->getKey()));
23+
assertEquals($user->getKey(), $this->cacheProfile->useCacheNameSuffix('foo'));
24+
});
25+
});

0 commit comments

Comments
 (0)