diff --git a/tests/Feature/CartTest.php b/tests/Feature/CartTest.php index 1a1e554..23ed9a5 100644 --- a/tests/Feature/CartTest.php +++ b/tests/Feature/CartTest.php @@ -10,12 +10,14 @@ use App\Domain\Commerce\CartLine; use App\Domain\Commerce\Checkout; use App\Domain\Commerce\Order; +use App\Domain\Commerce\ProductOptions; use App\Domain\Commerce\StaleOverview; use App\Domain\Entitlement\GrantIssuer; use App\Models\User; use App\Notifications\VerifyEmailAddress; use Database\Seeders\ShopDemoSeeder; use Illuminate\Foundation\Testing\RefreshDatabase; +use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Notification; use Illuminate\Support\Facades\URL; use Tests\Support\BuildsShop; @@ -40,7 +42,7 @@ public function test_a_guest_fills_the_cart_and_the_same_option_is_one_position( { $offer = $this->privateKonflikte(); - $this->post(route('cart.add', $offer))->assertRedirect(route('public.program', $offer->composition_id)); + $this->post(route('cart.add', $offer))->assertRedirect(app(ProductOptions::class)->pageUrl($offer)); $this->post(route('cart.add', $offer))->assertSessionHas('status'); $this->assertSame(1, app(Cart::class)->count()); @@ -75,7 +77,7 @@ public function test_alternative_options_of_one_product_page_are_replaced_only_a $this->assertFalse(app(Cart::class)->has($club)); $this->withSession(['shop.switch' => $club->id]) - ->get(route('public.program', $club->composition_id)) + ->get(app(ProductOptions::class)->pageUrl($club)) ->assertSee('Optionen wechseln?') ->assertSee('Zu „Mehrfachlizenz für Vereine“ wechseln') ->assertSee('Bei „Privatlizenz“ bleiben'); diff --git a/tests/Feature/CatalogRulesTest.php b/tests/Feature/CatalogRulesTest.php index a39cb14..4b2a2f7 100644 --- a/tests/Feature/CatalogRulesTest.php +++ b/tests/Feature/CatalogRulesTest.php @@ -187,6 +187,7 @@ public function test_h_a_bundle_change_does_not_change_an_activated_offer(): voi $offer = app(OfferService::class)->activate( app(OfferService::class)->create('Programmangebot'), [['target' => $published, 'rights' => $rights]], + ['grant_kind' => 'kauf', 'price_cents' => 1000], ); $bundles->publish($bundle, [$first, $second]); @@ -213,6 +214,7 @@ public function test_publication_records_impact_and_withdrawal_restores_the_prev app(OfferService::class)->activate( app(OfferService::class)->create('Blattangebot'), [['target' => $article, 'rights' => $rights]], + ['grant_kind' => 'kauf', 'price_cents' => 1000], ); $party = Party::query()->create([ 'type' => PartyType::Person, @@ -265,7 +267,7 @@ public function test_each_holder_gets_an_own_acquisition_and_one_grant_per_artic $offer = app(OfferService::class)->create('Kostenlos'); app(OfferService::class)->activate($offer, [ ['target' => $article, 'rights' => $rights], - ]); + ], ['grant_kind' => 'auf_abruf']); $acquisitions = []; diff --git a/tests/Feature/OfferOptionAdminTest.php b/tests/Feature/OfferOptionAdminTest.php index 04c4d15..cfa51ba 100644 --- a/tests/Feature/OfferOptionAdminTest.php +++ b/tests/Feature/OfferOptionAdminTest.php @@ -5,6 +5,7 @@ use App\Domain\Catalog\OfferStatus; use App\Domain\Commerce\Cart; use App\Domain\Commerce\CartLine; +use App\Domain\Commerce\ProductOptions; use App\Filament\Resources\Offers\Pages\ListOffers; use App\Filament\Resources\Offers\Pages\ViewOffer; use App\Models\User; @@ -78,7 +79,7 @@ public function test_the_mask_is_prefilled_names_the_option_and_states_the_effec $this->assertStringContainsString('„Abbrechen“ verwirft die Eingaben', $description); $this->assertSame('Fassung 2 aktivieren', $action->getModalSubmitActionLabel()); $this->assertSame('Privatlizenz', $data['option_label']); - $this->assertSame((string) $offer->composition_id, (string) $data['composition_id']); + $this->assertArrayNotHasKey('composition_id', $data, 'Die Produktseite wird nicht mehr zugeordnet, sie ergibt sich aus dem Artikel.'); $this->assertSame('person', $data['holder_kind']); $this->assertSame('kauf', $data['grant_kind']); $this->assertSame('49,00', $data['price_euro'], 'Der Preis steht in Euro, nicht in Cent.'); @@ -125,7 +126,7 @@ public function test_activating_changes_only_this_option_and_leaves_the_others_p $this->assertSame(1, $untouched->versions()->count()); $this->assertNotNull(app(Cart::class)->purchasable($untouched)); } - $this->get(route('public.program', $offer->composition_id)) + $this->get(app(ProductOptions::class)->pageUrl($offer)) ->assertSee('39,00 €') ->assertSee('Privatlizenz (neu)') ->assertSee('149,00 €');