Incentive (E1): VIP-Badge in der Navigation, solange ein Incentive nur fuer VIP sichtbar ist

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
Kevin 2026-09-22 13:41:32 +00:00
parent b38c6ca8e0
commit 96d7a9565e
2 changed files with 20 additions and 0 deletions

View file

@ -41,6 +41,7 @@ function vipTestUser(int $admin = 0): User
'account_id' => $account->id,
'payment_account' => now()->addYear(),
'wizard' => 100,
'active' => 1,
]);
}
@ -93,6 +94,20 @@ it('zeigt VIP-Konten Teaser und Rangliste eines VIP-Incentives', function () {
$this->get(route('user_incentive_teaser', [$incentive->slug]))->assertOk();
});
it('zeigt in der Navigation ein VIP-Badge am VIP-Incentive', function () {
$incentive = vipOnlyChallenge();
$public = vipOnlyChallenge(['vip_only' => false, 'name' => 'Offenes Incentive']);
$this->actingAs(vipTestUser(admin: 1));
$html = $this->get(route('user_incentive_teaser', [$public->slug]))->assertOk()->getContent();
$vipEntry = substr($html, strpos($html, route('user_incentive_teaser', [$incentive->slug])), 600);
$publicEntry = substr($html, strpos($html, route('user_incentive_teaser', [$public->slug]).'"'), 600);
expect($vipEntry)->toContain('badge badge-secondary')
->and($publicEntry)->not->toContain('badge badge-secondary');
});
it('zeigt allen Beratern ein Incentive ohne VIP-Sperre', function () {
$incentive = vipOnlyChallenge(['vip_only' => false]);