Skip to content

Commit 9c53ef5

Browse files
committed
wip
1 parent c2f47de commit 9c53ef5

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
3+
use Foxws\UserCache\Events\ClearingUserCache;
4+
use Foxws\UserCache\Events\ClearedUserCache;
5+
use Foxws\UserCache\UserCacheRepository;
6+
use Illuminate\Cache\Repository;
7+
use Illuminate\Support\Facades\Artisan;
8+
use Illuminate\Support\Facades\Event;
9+
10+
beforeEach(function () {
11+
$this->createTaggableResponseCacheStore = function (): Repository {
12+
// Simulating construction of Repository inside of the service provider
13+
return $this->app->contextual[UserCacheRepository::class][$this->app->getAlias(Repository::class)]();
14+
};
15+
});
16+
17+
it('will fire events when clearing the cache', function () {
18+
Event::fake();
19+
20+
Artisan::call('usercache:clear');
21+
22+
Event::assertDispatched(ClearingUserCache::class);
23+
Event::assertDispatched(ClearedUserCache::class);
24+
});

0 commit comments

Comments
 (0)