+ {{ $participant ? __('incentive.pending_confirmation_banner') : __('incentive.participate_intro') }} +
+ + {{-- Hervorhebungen: worum es geht --}} +{{ __('incentive.not_active') }}
+ @endif + @if ($incentive->getLang('terms')) + + {{ __('incentive.join_terms_toggle') }} + + + @endif{{ $incentive->getLang('subtitle') }}
@endif @if ($incentive->image) @@ -744,19 +1004,15 @@{{ __('incentive.min_qual_intro') }}
-- - {{ __('incentive.min_qual_ranking_hint') }} -
-{{ __('incentive.min_qual_intro') }}
++ + {{ __('incentive.min_qual_ranking_hint') }} +
{{ __('incentive.participate_intro') }}
- @if (!empty($participateHasTrackableAbos)) -{{ __('incentive.not_active') }}
- @endif -Bedingungen Text
']); + $this->actingAs(vipTestUser()); + + $response = $this->get(route('user_incentive_show', [$incentive->slug]))->assertOk(); + $html = $response->getContent(); + + $join = strpos($html, 'id="incentive-join"'); + $divider = strpos($html, 'class="inc-divider"'); + $title = strpos($html, 'class="inc-page-title"'); + $ranking = strpos($html, 'class="inc-ranking-card mt-2'); + + expect($join)->not->toBeFalse() + ->and($divider)->toBeGreaterThan($join) + ->and($title)->toBeGreaterThan($divider) + ->and($ranking)->toBeGreaterThan($title); + + $response->assertSee(__('incentive.join_title')) + ->assertSee('50,00 €') + ->assertSee(__('incentive.join_highlight_rank', ['amount' => '500,00 €', 'n' => 1])) + ->assertSee(__('incentive.join_terms_toggle')) + ->assertSee('Bedingungen Text', false) + ->assertSee('id="incentive-payout-tile"', false); + }); + + it('nennt den Block "Teilnahme bestaetigen", wenn Punkte schon laufen', function () { + $incentive = vipOnlyChallenge(['vip_only' => false]); + $user = vipTestUser(); + IncentiveParticipant::factory()->unconfirmed()->create([ + 'incentive_id' => $incentive->id, 'user_id' => $user->id, + 'qualified_partners' => 2, 'total_points' => 2, 'is_qualified' => true, 'rank' => 1, + ]); + $this->actingAs($user); + + $this->get(route('user_incentive_show', [$incentive->slug])) + ->assertOk() + ->assertSee(__('incentive.join_confirm_title')) + ->assertSee(__('incentive.payout_so_far')) + ->assertSee('600,00 €'); + }); + + it('zeigt bestaetigten Teilnehmern keinen Teilnahme-Block', function () { + $incentive = vipOnlyChallenge(['vip_only' => false]); + $user = vipTestUser(); + IncentiveParticipant::factory()->create([ + 'incentive_id' => $incentive->id, 'user_id' => $user->id, + 'qualified_partners' => 1, 'total_points' => 1, 'is_qualified' => true, 'rank' => 1, + ]); + $this->actingAs($user); + + $this->get(route('user_incentive_show', [$incentive->slug])) + ->assertOk() + ->assertDontSee('id="incentive-join"', false) + ->assertSee(__('incentive.my_details')); + }); +}); diff --git a/tests/Feature/Incentive/RecruitingChallengeSeederTest.php b/tests/Feature/Incentive/RecruitingChallengeSeederTest.php index 175f7187..27011532 100644 --- a/tests/Feature/Incentive/RecruitingChallengeSeederTest.php +++ b/tests/Feature/Incentive/RecruitingChallengeSeederTest.php @@ -16,6 +16,7 @@ it('legt die Challenge als Entwurf mit Praemie und Wertung nach Neupartnern an', $incentive = Incentive::where('slug', RecruitingChallenge2026Seeder::SLUG)->firstOrFail(); expect($incentive->isDraft())->toBeTrue() + ->and($incentive->vip_only)->toBeTrue() ->and($incentive->name)->toBe('Recruiting Challenge 2026/27') ->and($incentive->qualification_start->toDateString())->toBe('2026-10-01') ->and($incentive->qualification_end->toDateString())->toBe('2027-01-31')