From a9960736799371d1340cc7fa6cb775409aebfbf3 Mon Sep 17 00:00:00 2001 From: Simon Hamp Date: Fri, 17 Jul 2026 17:56:56 +0100 Subject: [PATCH] Move BeyondCode & Laradevs to sponsors in docs sidebar rotation Move the two entries from the partners rotation to the sponsors rotation, and render both docs sidebar lists client-side (Alpine render-all + random pick) via an injectable pool prop, mirroring the ad-rotation component. Tests now cover the rotation mechanism with injected fixtures instead of asserting specific sponsor/partner names. Co-Authored-By: Claude Opus 4.8 (1M context) --- .../lists/docs/featured-sponsors.blade.php | 90 +++++++++---------- .../sponsors/lists/docs/sponsors.blade.php | 84 ++++++++++------- .../SponsorsAndPartnersPlacementTest.php | 57 ++++++------ 3 files changed, 120 insertions(+), 111 deletions(-) diff --git a/resources/views/components/sponsors/lists/docs/featured-sponsors.blade.php b/resources/views/components/sponsors/lists/docs/featured-sponsors.blade.php index 927f2774..a6d98281 100644 --- a/resources/views/components/sponsors/lists/docs/featured-sponsors.blade.php +++ b/resources/views/components/sponsors/lists/docs/featured-sponsors.blade.php @@ -1,5 +1,7 @@ +@props(['partners' => null]) + @php - $partners = [ + $partners ??= [ [ 'url' => 'https://nexcalia.com/?ref=nativephp', 'name' => 'Nexcalia', @@ -22,54 +24,44 @@ 'imageDark' => '/img/sponsors/synergi-dark.svg', 'class' => 'w-full', ], - [ - 'url' => 'https://laradevs.com/?ref=nativephp', - 'name' => 'Laradevs', - 'tagline' => 'Hire the best Laravel developers anywhere', - 'component' => 'sponsors.logos.laradevs', - 'class' => 'w-full text-black dark:text-white', - ], - [ - 'url' => 'https://beyondco.de/?utm_source=nativephp&utm_medium=logo&utm_campaign=nativephp', - 'name' => 'BeyondCode', - 'tagline' => 'Essential tools for web developers', - 'image' => '/img/sponsors/beyondcode.webp', - 'imageDark' => '/img/sponsors/beyondcode-dark.webp', - 'class' => 'w-full', - ], ]; - - $partner = $partners[array_rand($partners)]; @endphp - -
- @if (isset($partner['component'])) -
- {{ $partner['tagline'] }} -
+
+ @foreach ($partners as $index => $partner) + +
+ @if (isset($partner['component'])) +
+ {{ $partner['tagline'] }} +
+ @endforeach +
diff --git a/resources/views/components/sponsors/lists/docs/sponsors.blade.php b/resources/views/components/sponsors/lists/docs/sponsors.blade.php index 7fe368e8..475ce906 100644 --- a/resources/views/components/sponsors/lists/docs/sponsors.blade.php +++ b/resources/views/components/sponsors/lists/docs/sponsors.blade.php @@ -1,5 +1,7 @@ +@props(['sponsors' => null]) + @php - $sponsors = [ + $sponsors ??= [ [ 'url' => 'https://artisan.build/?utm_source=nativephp&utm_medium=logo&utm_campaign=nativephp', 'name' => 'Artisan Build', @@ -7,37 +9,55 @@ 'imageDark' => '/img/sponsors/artisan-build-dark.webp', 'class' => 'w-full', ], + [ + 'url' => 'https://beyondco.de/?utm_source=nativephp&utm_medium=logo&utm_campaign=nativephp', + 'name' => 'BeyondCode', + 'image' => '/img/sponsors/beyondcode.webp', + 'imageDark' => '/img/sponsors/beyondcode-dark.webp', + 'class' => 'w-full', + ], + [ + 'url' => 'https://laradevs.com/?ref=nativephp', + 'name' => 'Laradevs', + 'component' => 'sponsors.logos.laradevs', + 'class' => 'w-full text-black dark:text-white', + ], ]; - - $sponsor = $sponsors[array_rand($sponsors)]; @endphp - - @if (isset($sponsor['component'])) - +
+ @foreach ($sponsors as $index => $sponsor) + + @if (isset($sponsor['component'])) + + @endforeach +
diff --git a/tests/Feature/SponsorsAndPartnersPlacementTest.php b/tests/Feature/SponsorsAndPartnersPlacementTest.php index 9a687168..0fe43e16 100644 --- a/tests/Feature/SponsorsAndPartnersPlacementTest.php +++ b/tests/Feature/SponsorsAndPartnersPlacementTest.php @@ -11,45 +11,42 @@ class SponsorsAndPartnersPlacementTest extends TestCase use RefreshDatabase; #[Test] - public function the_partners_section_no_longer_lists_beyondcode_or_laradevs() + public function the_partners_page_renders_the_partners_section() { - $this->blade('') - ->assertSee('Nexcalia') - ->assertSee('Web Mavens') - ->assertDontSee('Laradevs') - ->assertDontSee('BeyondCode') - ->assertDontSee('Need a freelancer or engineer?') - ->assertDontSee('From local full stack development'); + $this->get(route('partners')) + ->assertOk() + ->assertSee('Meet Our Partners'); } #[Test] - public function the_sponsors_section_lists_beyondcode_and_laradevs_without_descriptions() + public function the_sidebar_partners_list_rotates_through_every_entry_it_is_given() { - $this->blade('') - ->assertSee('Artisan Build') - ->assertSee('BeyondCode') - ->assertSee('Laradevs') - ->assertDontSee('Need a freelancer or engineer?') - ->assertDontSee('From local full stack development'); - } + $partners = [ + ['url' => 'https://partner-one.test', 'name' => 'Partner One', 'tagline' => 'First', 'image' => '/img/one.svg', 'imageDark' => '/img/one-dark.svg', 'class' => ''], + ['url' => 'https://partner-two.test', 'name' => 'Partner Two', 'tagline' => 'Second', 'image' => '/img/two.svg', 'imageDark' => '/img/two-dark.svg', 'class' => ''], + ]; - #[Test] - public function the_homepage_drops_the_partner_descriptions_for_beyondcode_and_laradevs() - { - $this->get('/') - ->assertOk() - ->assertDontSee('Need a freelancer or engineer?') - ->assertDontSee('From local full stack development'); + $this->blade('', compact('partners')) + ->assertSee('Math.random() * 2', false) + ->assertSee('x-show="partner === 0"', false) + ->assertSee('x-show="partner === 1"', false) + ->assertSee('https://partner-one.test') + ->assertSee('https://partner-two.test'); } #[Test] - public function the_partners_page_lists_the_current_partners() + public function the_sidebar_sponsors_list_rotates_through_every_entry_it_is_given() { - $this->get(route('partners')) - ->assertOk() - ->assertSee('Meet Our Partners') - ->assertSee('Nexcalia') - ->assertSee('Web Mavens') - ->assertSee('Synergi Tech'); + $sponsors = [ + ['url' => 'https://sponsor-one.test', 'name' => 'Sponsor One', 'image' => '/img/one.svg', 'imageDark' => '/img/one-dark.svg', 'class' => ''], + ['url' => 'https://sponsor-two.test', 'name' => 'Sponsor Two', 'image' => '/img/two.svg', 'imageDark' => '/img/two-dark.svg', 'class' => ''], + ]; + + $this->blade('', compact('sponsors')) + ->assertSee('Math.random() * 2', false) + ->assertSee('x-show="sponsor === 0"', false) + ->assertSee('x-show="sponsor === 1"', false) + ->assertSee('https://sponsor-one.test') + ->assertSee('https://sponsor-two.test'); } }