Incentive (E1): Teaser und Rangliste zu einer Incentive-Seite zusammengefasst

Eine Seite unter /incentive/{slug}: oben Teilnahme-Block mit Bedingungen
(oder fuer bestaetigte Teilnehmer der Kopf mit Rang, Punkten, Praemie und
Bedingungen zum Aufklappen), darunter Titelbild, Text, Kacheln, "So
funktioniert es", Galerie und das Live-Ranking mit Sprungmarke #ranking.
Die alte URL /incentive/{slug}/ranking leitet dorthin um, Dashboard und
Detailseite verlinken auf die Sprungmarke, show.blade.php entfaellt.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
Kevin 2026-09-22 13:11:10 +00:00
parent 483cad3391
commit b83b43ef4c
10 changed files with 1010 additions and 1401 deletions

View file

@ -65,7 +65,7 @@ it('teaser view receives galleryImages and participant data', function () {
$incentive = Incentive::factory()->active()->create();
$user = User::forceCreate([
'email' => 'teaser-' . uniqid('', true) . '@example.com',
'email' => 'teaser-'.uniqid('', true).'@example.com',
'password' => bcrypt('secret'),
'lang' => 'de',
'active' => 1,
@ -83,7 +83,7 @@ it('teaser view receives galleryImages and participant data', function () {
$response = $controller->teaser($incentive->slug);
$data = $response->getData();
expect($data)->toHaveKeys(['incentive', 'participant', 'galleryImages'])
expect($data)->toHaveKeys(['incentive', 'participant', 'galleryImages', 'ranking', 'hasConfirmedParticipation'])
->and($data['incentive']->id)->toBe($incentive->id)
->and($data['participant']->id)->toBe($participant->id)
->and($data['galleryImages'])->toBeArray();

View file

@ -81,7 +81,7 @@ it('liefert normalen Beratern 404 fuer Teaser, Rangliste, Details und Teilnahme'
$this->actingAs(vipTestUser());
$this->get(route('user_incentive_teaser', [$incentive->slug]))->assertNotFound();
$this->get(route('user_incentive_show', [$incentive->slug]))->assertNotFound();
$this->get(route('user_incentive_show', [$incentive->slug]))->assertRedirect(route('user_incentive_teaser', [$incentive->slug]).'#ranking');
$this->get(route('user_incentive_details', [$incentive->slug]))->assertNotFound();
$this->post(route('user_incentive_participate', [$incentive->slug]), ['accept_terms' => 1])->assertNotFound();
});
@ -90,16 +90,14 @@ it('zeigt VIP-Konten Teaser und Rangliste eines VIP-Incentives', function () {
$incentive = vipOnlyChallenge();
$this->actingAs(vipTestUser(admin: 1));
$teaser = $this->get(route('user_incentive_teaser', [$incentive->slug]));
$teaser->assertOk();
$this->get(route('user_incentive_show', [$incentive->slug]))->assertOk();
$this->get(route('user_incentive_teaser', [$incentive->slug]))->assertOk();
});
it('zeigt allen Beratern ein Incentive ohne VIP-Sperre', function () {
$incentive = vipOnlyChallenge(['vip_only' => false]);
$this->actingAs(vipTestUser());
$this->get(route('user_incentive_show', [$incentive->slug]))->assertOk();
$this->get(route('user_incentive_teaser', [$incentive->slug]))->assertOk();
});
it('speichert den VIP-Haken im Admin und zeigt ihn auf der Detailseite', function () {
@ -128,23 +126,26 @@ it('speichert den VIP-Haken im Admin und zeigt ihn auf der Detailseite', functio
->assertSee('id="incentive-vip-only-badge"', false);
});
describe('Ranglisten-Seite: Teilnahme-Block oben', function () {
describe('Incentive-Seite: Teilnahme-Block oben, Rangliste unten', function () {
it('zeigt ohne Bestaetigung den Teilnahme-Block mit Praemie zuerst, dann Trennlinie und Inhalt', function () {
$incentive = vipOnlyChallenge(['vip_only' => false, 'terms' => '<p>Bedingungen Text</p>']);
$incentive = vipOnlyChallenge(['vip_only' => false, 'image' => 'challenge.jpg', 'terms' => '<p>Bedingungen Text</p>']);
$this->actingAs(vipTestUser());
$response = $this->get(route('user_incentive_show', [$incentive->slug]))->assertOk();
$response = $this->get(route('user_incentive_teaser', [$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');
$hero = strpos($html, 'class="incentive-hero mb-5"');
$howItWorks = strpos($html, 'id="incentive-how-it-works"');
$ranking = strpos($html, 'id="ranking"');
expect($join)->not->toBeFalse()
->and($divider)->toBeGreaterThan($join)
->and($title)->toBeGreaterThan($divider)
->and($ranking)->toBeGreaterThan($title);
->and($hero)->toBeGreaterThan($divider)
->and($howItWorks)->toBeGreaterThan($hero)
->and($ranking)->toBeGreaterThan($howItWorks)
->and(substr_count($html, 'id="terms"'))->toBe(1);
$response->assertSee(__('incentive.join_title'))
->assertSee('50,00 €')
@ -166,14 +167,14 @@ describe('Ranglisten-Seite: Teilnahme-Block oben', function () {
]);
$this->actingAs($user);
$this->get(route('user_incentive_show', [$incentive->slug]))
$this->get(route('user_incentive_teaser', [$incentive->slug]))
->assertOk()
->assertSee(__('incentive.join_confirm_title'))
->assertSee(__('incentive.payout_so_far'))
->assertSee('600,00 €');
});
it('zeigt bestaetigten Teilnehmern keinen Teilnahme-Block', function () {
it('zeigt bestaetigten Teilnehmern den Kopf mit Stand statt des Teilnahme-Blocks', function () {
$incentive = vipOnlyChallenge(['vip_only' => false]);
$user = vipTestUser();
IncentiveParticipant::factory()->create([
@ -182,10 +183,13 @@ describe('Ranglisten-Seite: Teilnahme-Block oben', function () {
]);
$this->actingAs($user);
$this->get(route('user_incentive_show', [$incentive->slug]))
$this->get(route('user_incentive_teaser', [$incentive->slug]))
->assertOk()
->assertDontSee('id="incentive-join"', false)
->assertSee('id="incentive-participant-header"', false)
->assertSee(__('incentive.my_details'))
->assertSee(__('incentive.join_terms_toggle'))
->assertSee('id="ranking"', false)
->assertSee('id="incentive-how-it-works"', false)
->assertDontSee(__('incentive.section_points'));
});
@ -199,13 +203,13 @@ describe('Teaser-Seite der Challenge', function () {
$response = $this->get(route('user_incentive_teaser', [$incentive->slug]))->assertOk();
$html = $response->getContent();
$cta = strpos($html, 'id="incentive-teaser-cta"');
$join = strpos($html, 'id="incentive-join"');
$hero = strpos($html, 'class="incentive-hero mb-5"');
expect($cta)->not->toBeFalse()
->and($hero)->toBeGreaterThan($cta);
expect($join)->not->toBeFalse()
->and($hero)->toBeGreaterThan($join);
$response->assertSee(__('incentive.teaser_cta_ready'))
$response->assertSee(__('incentive.join_title'))
->assertSee(__('incentive.payout_per_partner_label'))
->assertSee('id="incentive-bonus-tile"', false)
->assertSee('id="incentive-how-it-works"', false)