Erkläre bei der Produktseiten-Zuordnung, warum ein Modul oder Lizenzartikel keine eigene Seite bekommt
CI Feature / test (push) Successful in 4m11s
Deploy Test / test (push) Successful in 3m55s
Deploy Test / deploy (push) Successful in 33s

Die Auswahl nennt je Eintrag, ob der Shop die Seite zeigen kann (Programm mit Anzeigefreigabe),
und die Fehlermeldung zur eigenen Paketseite nennt den Weg über Pakete oder ein Programm.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
LarsandClaude Sonnet 5.5 committed 2026-11-25 16:30:32 +01:00
1 parent 9041afda80
commit 1950dc377b
4 files changed
+51 -5

No files matched your search

@@ -8,6 +8,7 @@
use App\Domain\Catalog\ContentElement;
use App\Domain\Catalog\ContentElementVersion;
use App\Domain\Catalog\ContentService;
use App\Domain\Catalog\DomainRuleException;
use App\Domain\Catalog\EditorialContentKind;
use App\Domain\Catalog\OfferService;
use App\Domain\Catalog\RightsProfileVersion;
@@ -240,6 +241,39 @@ private function rights(): RightsProfileVersion
return RightsProfileVersion::query()->orderBy('id')->firstOrFail();
}
public function test_the_product_page_choices_say_which_ones_the_shop_can_show(): void
{
$hidden = $this->hiddenProgram();
$module = app(ContentService::class)->createComposition('Bündel-Modul');
$module->editorial_content_kind_id = EditorialContentKind::query()->where('slug', 'modul')->value('id');
$module->save();
$method = new \ReflectionMethod(ViewOffer::class, 'productPages');
$choices = $method->invoke(app(ViewOffer::class));
$this->assertStringContainsString('nur für ein Angebot aus genau einer Paketfassung', $choices['__paket']);
$this->assertStringContainsString('im Shop auffindbar', $choices[$this->program('Konflikte im Training')->id]);
$this->assertStringContainsString('noch nicht zur Anzeige freigegeben', $choices[$hidden->id]);
$this->assertStringContainsString('kein Programm', $choices[$module->id]);
$this->assertStringContainsString('nur Programme', $choices[$module->id]);
}
public function test_an_own_bundle_page_for_a_licence_article_is_refused_with_the_way_forward(): void
{
$offer = app(OfferService::class)->create('Bündel als Artikel');
app(OfferService::class)->assignProduct($offer, null, null, true);
try {
app(OfferService::class)->activate($offer->refresh(), [['target' => $this->article('shop-konflikte'), 'rights' => $this->rights()]], ['grant_kind' => 'kauf', 'price_cents' => 3900, 'holder_kind' => 'person']);
$this->fail('Ein Lizenzartikel darf keine eigene Paketseite bekommen.');
} catch (DomainRuleException $e) {
$this->assertStringContainsString('Katalog → Pakete', $e->getMessage());
$this->assertStringContainsString('Programm', $e->getMessage());
}
$this->assertSame(0, $offer->versions()->count());
}
private function hiddenProgram(): Composition
{
$composition = app(ContentService::class)->createComposition('Unveröffentlichtes Programm');