Mache den Lizenzartikel zur Produktseite und leite die Seite aus dem Angebot ab
CI Feature / test (push) Failing after 3m16s
CI Feature / test (push) Failing after 3m16s
Die Produktseite ist die Seite des Artikels (/shop/{id}), den die Option als einzige
Position verkauft, oder die Paketseite. Sie wird nicht mehr einem Programm zugeordnet.
Ein Kauf braucht genau eine Position und einen Preis, sonst lässt er sich nicht aktivieren.
Module und Programme werden dadurch nicht öffentlich (Karten und /programme unverändert).
Tests: Die Tests, die eine Programmseite als Produktseite voraussetzten, prüfen jetzt die
Artikelseite; die Zuordnung „eigene Paketseite oder Programmseite“ entfällt (ADR-52).
Ein Altbestandstest sichert die Programmseite für Angebote mit mehreren Positionen.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
1950dc377b
commit
08f7d0c63d
22 files changed
+544
-275
No files matched your search
@@ -407,18 +407,50 @@ public function test_the_checkout_says_so_when_no_holder_is_allowed(): void
|
||||
->assertDontSee('Alle Positionen sind bereits erworben');
|
||||
}
|
||||
|
||||
public function test_only_options_with_a_public_product_page_can_be_put_into_the_cart(): void
|
||||
public function test_only_purchasable_options_can_be_put_into_the_cart(): void
|
||||
{
|
||||
$this->privateGrenzen()->update(['composition_id' => null]);
|
||||
$this->post(route('cart.add', $this->privateGrenzen()))->assertSessionHasErrors('shop');
|
||||
app(OfferService::class)->end($this->privateGrenzen());
|
||||
|
||||
$this->post(route('cart.add', $this->privateGrenzen()))->assertSessionHasErrors('shop');
|
||||
$this->assertSame(0, app(Cart::class)->count());
|
||||
}
|
||||
|
||||
public function test_alternatives_are_the_options_of_one_article_and_not_those_of_different_articles(): void
|
||||
{
|
||||
$cart = app(Cart::class);
|
||||
$this->assertSame(Cart::ADDED, $cart->add($this->privateKonflikte()));
|
||||
|
||||
$this->assertSame(Cart::ALTERNATIVE, $cart->add($this->clubKonflikte()), 'Zwei Optionen desselben Artikels sind Alternativen.');
|
||||
$this->assertSame(Cart::ADDED, $cart->add($this->privateGrenzen()), 'Ein anderer Artikel liegt zusätzlich im Warenkorb.');
|
||||
$this->assertSame(2, $cart->count());
|
||||
}
|
||||
|
||||
public function test_a_legacy_offer_with_several_positions_stays_on_its_program_page_while_that_is_shown(): void
|
||||
{
|
||||
$program = $this->program('Konflikte im Training');
|
||||
$rights = app(OfferService::class)->currentActiveVersion($this->privateKonflikte())->lines()->first()->rights;
|
||||
$offer = app(OfferService::class)->create('Altbestand');
|
||||
app(OfferService::class)->activate($offer, [
|
||||
['target' => $this->article('shop-konflikte'), 'rights' => $rights],
|
||||
['target' => $this->article('shop-grenzen'), 'rights' => $rights],
|
||||
], ['grant_kind' => 'auf_abruf', 'holder_kind' => 'person']);
|
||||
// So steht ein früher als Kauf aktivierter Altbestand in der Datenbank: mehrere Positionen, Programmseite.
|
||||
DB::table('offer_versions')->where('offer_id', $offer->id)->update(['grant_kind' => 'kauf', 'price_cents' => 1000]);
|
||||
DB::table('offers')->where('id', $offer->id)->update(['composition_id' => $program->id, 'option_label' => 'Altbestand']);
|
||||
$offer = $offer->refresh();
|
||||
|
||||
$this->assertSame('c:'.$program->id, app(ProductOptions::class)->groupKey($offer));
|
||||
$this->get(route('public.program', $program))->assertOk()->assertSee('Altbestand');
|
||||
$this->post(route('cart.add', $offer))->assertSessionDoesntHaveErrors();
|
||||
$this->assertSame(1, app(Cart::class)->count());
|
||||
|
||||
app(Cart::class)->clear();
|
||||
$program->versions()->each(fn ($version) => $version->displayEvents()->create([
|
||||
'event' => CompositionVersionDisplayEvent::REVOKED,
|
||||
'actor_id' => $this->tina()->id,
|
||||
'occurred_at' => now()->addSecond(),
|
||||
]));
|
||||
$this->post(route('cart.add', $this->privateKonflikte()))->assertSessionHasErrors('shop');
|
||||
$this->post(route('cart.add', $offer))->assertSessionHasErrors('shop');
|
||||
$this->assertSame(0, app(Cart::class)->count());
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user