Current state with latest updates

This commit is contained in:
2026-08-23 13:28:34 +02:00
parent 5af95f6533
commit f52879edbb
74 changed files with 5174 additions and 960 deletions
+20 -7
View File
@@ -412,6 +412,10 @@ test('removing a medal dispatches artwork reindexing', function () {
});
test('cache invalidation occurs after medal updates', function () {
// HomepageService::clearFeaturedAndMedalCaches() forgets homepage.hero.{segment},
// homepage.community-favorites.8.{segment} and homepage.hall-of-fame.8.{segment} for
// each viewer-visibility segment (see HomepageService::viewerCacheSegment()) — not the
// bare, unsegmented keys this test originally asserted against pre-segmentation.
$homepage = app(HomepageService::class);
$service = app(ArtworkAwardService::class);
$user = User::factory()->create(['created_at' => now()->subDays(30), 'email_verified_at' => now()]);
@@ -420,15 +424,24 @@ test('cache invalidation occurs after medal updates', function () {
Config::set('homepage.guest_payload_key', $guestPayloadKey);
Cache::put('homepage.hero', ['stale' => true], 600);
Cache::put('homepage.community-favorites.8', ['stale' => true], 600);
Cache::put('homepage.hall-of-fame.8', ['stale' => true], 600);
$segments = ['visibility-hide', 'visibility-blur', 'visibility-show'];
$segmentedKeys = collect($segments)
->flatMap(fn (string $segment): array => [
"homepage.hero.{$segment}",
"homepage.community-favorites.8.{$segment}",
"homepage.hall-of-fame.8.{$segment}",
])
->all();
foreach ($segmentedKeys as $key) {
Cache::put($key, ['stale' => true], 600);
}
Cache::store($homepage->guestPayloadCacheStoreName())->put($guestPayloadKey, ['stale' => true], 600);
$service->award($artwork, $user, 'gold');
expect(Cache::get('homepage.hero'))->toBeNull()
->and(Cache::get('homepage.community-favorites.8'))->toBeNull()
->and(Cache::get('homepage.hall-of-fame.8'))->toBeNull()
->and(Cache::store($homepage->guestPayloadCacheStoreName())->get($guestPayloadKey))->toBeNull();
foreach ($segmentedKeys as $key) {
expect(Cache::get($key))->toBeNull();
}
expect(Cache::store($homepage->guestPayloadCacheStoreName())->get($guestPayloadKey))->toBeNull();
});