Boost-Slot-Grenzen (5/3) + Kategorie-Boost zum halben Satz
Entscheidung 13.07.: verkauft wird nur, was sichtbar ist — max. 5 gleichzeitige Boosts je Startseite, 3 je Branchenseite (= die sichtbaren Plaetze; Hero-Slider damit vertagt). Neue Stufe Kategorie-Boost (nur Branchenseite, 6/10/18 Credits = 50 % aufgerundet); der Startseiten-Boost (12/20/35) erscheint weiter auf Start- UND Branchenseite. - boosts.placement (home/category, Bestand = home) + BoostPlacement-Enum; Preise/Slots in config/credits.php (boost_category, boost_slots) - BoostService::slotAvailability() je Ausgabe (Portal x Sprache, Kategorie zusaetzlich je Rubrik); ausgebucht -> soldOut-Exception mit fruehestem freien Termin; Verlaengerungen halten ihren Slot, Stufen verlaengern unabhaengig; Kategorie-Boost invalidiert nur Kategorie-Caches - Startseite zeigt nur Home-Boosts; Branchenseite: Kategorie-Boosts mit Vorrang (ihre 3 Slots sind die Garantie), Home-Boosts fuellen den Rest - Add-on-Panel der PM-Seite: zwei Boost-Angebote, bei vollem Inventar "Derzeit ausgebucht — frei ab" statt Kauf-Buttons (serverseitig gegated); Buchungsseiten-Preisliste um die Kategorie-Staffel ergaenzt Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
b1be14e1b3
commit
4853d48b83
19 changed files with 702 additions and 98 deletions
|
|
@ -1,5 +1,6 @@
|
|||
<?php
|
||||
|
||||
use App\Enums\BoostPlacement;
|
||||
use App\Enums\Portal;
|
||||
use App\Enums\PressReleaseClassification;
|
||||
use App\Models\Boost;
|
||||
|
|
@ -10,6 +11,7 @@ use App\Models\User;
|
|||
use App\Services\Billing\CreditWalletService;
|
||||
use App\Services\PressRelease\BoostService;
|
||||
use App\Services\Web\HomePageData;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Tests\TestCase;
|
||||
|
||||
/**
|
||||
|
|
@ -126,3 +128,75 @@ test('a boosted release leads its category page and is labelled', function () {
|
|||
'Neueste unbezahlte Meldung',
|
||||
]);
|
||||
});
|
||||
|
||||
test('a category boost leads its category page but never the homepage', function () {
|
||||
/** @var TestCase $this */
|
||||
['boosted' => $boosted, 'newest' => $newest] = boostPlacementFixture();
|
||||
|
||||
Boost::factory()->for($boosted)->category()->create();
|
||||
|
||||
// Branchenseite: Kategorie-Boost besetzt den Lead-Slot.
|
||||
$this->get('https://presseecho.test/de/category/energie-klima')
|
||||
->assertSuccessful()
|
||||
->assertSeeTextInOrder(['Top-Platzierung', 'Geboostete aeltere Meldung']);
|
||||
|
||||
// Startseite: bleibt bei der Chronologie — der Kategorie-Boost kauft
|
||||
// sie nicht mit (Entscheidung 13.07.).
|
||||
$data = app(HomePageData::class)->build(Portal::Presseecho);
|
||||
expect($data['leadRelease']->id)->toBe($newest->id)
|
||||
->and($data['boostedIds'])->toBe([]);
|
||||
});
|
||||
|
||||
test('category boosts take the category slots ahead of homepage boosts', function () {
|
||||
/** @var TestCase $this */
|
||||
['boosted' => $categoryBoosted, 'newest' => $newest, 'category' => $category, 'company' => $company] = boostPlacementFixture();
|
||||
|
||||
// Neuere PM mit Startseiten-Boost — auf der Branchenseite hat der
|
||||
// Kategorie-Boost trotzdem Vorrang (seine 3 Slots sind die Garantie).
|
||||
$homeBoosted = PressRelease::factory()
|
||||
->published()
|
||||
->forPortal(Portal::Presseecho)
|
||||
->for($category)
|
||||
->for($company)
|
||||
->create([
|
||||
'title' => 'Startseiten-Boost Meldung',
|
||||
'slug' => 'startseiten-boost-meldung',
|
||||
'published_at' => now()->subHour(),
|
||||
'classification' => PressReleaseClassification::Green->value,
|
||||
]);
|
||||
|
||||
Boost::factory()->for($categoryBoosted)->category()->create();
|
||||
Boost::factory()->for($homeBoosted)->create();
|
||||
|
||||
// Ohne Vorrang würde die neuere Startseiten-Boost-Meldung den Lead
|
||||
// chronologisch gewinnen — der Kategorie-Boost muss vorne stehen.
|
||||
$this->get('https://presseecho.test/de/category/energie-klima')
|
||||
->assertSuccessful()
|
||||
->assertSeeTextInOrder([
|
||||
'Geboostete aeltere Meldung',
|
||||
'Startseiten-Boost Meldung',
|
||||
]);
|
||||
});
|
||||
|
||||
test('booking a category boost invalidates the category page but keeps the homepage cache', function () {
|
||||
/** @var TestCase $this */
|
||||
['boosted' => $boosted, 'newest' => $newest] = boostPlacementFixture();
|
||||
|
||||
$owner = User::factory()->create(['is_active' => true]);
|
||||
app(CreditWalletService::class)->credit($owner, 40);
|
||||
|
||||
// Beide Seiten in den Cache legen — noch ohne Boost.
|
||||
expect(app(HomePageData::class)->build(Portal::Presseecho)['leadRelease']->id)->toBe($newest->id);
|
||||
$this->get('https://presseecho.test/de/category/energie-klima')
|
||||
->assertSuccessful()
|
||||
->assertDontSeeText('Top-Platzierung');
|
||||
|
||||
app(BoostService::class)->boost($owner, $boosted, 7, BoostPlacement::Category);
|
||||
|
||||
// Branchenseite sofort aktualisiert, Startseiten-Cache bleibt stehen
|
||||
// (der Kategorie-Boost berührt die Startseite nicht).
|
||||
expect(Cache::has('web.home.presseecho.de'))->toBeTrue();
|
||||
$this->get('https://presseecho.test/de/category/energie-klima')
|
||||
->assertSuccessful()
|
||||
->assertSeeText('Top-Platzierung');
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue