From 2d5bc6518e22d014567443b6fb6d242f540cbc72 Mon Sep 17 00:00:00 2001 From: Kevin Adametz Date: Wed, 9 Sep 2026 15:01:31 +0000 Subject: [PATCH] =?UTF-8?q?Warenwirtschaft:=20AP-47=20=E2=80=94=20Regressi?= =?UTF-8?q?onstest=20f=C3=BCr=20die=20Checkbox=20=E2=80=9Eproduktionsrelev?= =?UTF-8?q?ant"=20=C3=BCber=20das=20Produktformular?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Nachfrage 09.09.2026 (Zukaufartikel wie Aloe sollen in der Produktion nicht auftauchen): Die Funktion existiert seit AP-47 (Checkbox am Produkt, Filter im Planungs-Dropdown und in „Enthalten in"). Bisher war nur der Dropdown-Filter getestet; der neue Test sichert den ganzen Weg Formular → Speichern → Produktions-Auswahl ab. Co-Authored-By: Claude Fable 5.1 --- tests/Feature/ProductFillWeightTest.php | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/tests/Feature/ProductFillWeightTest.php b/tests/Feature/ProductFillWeightTest.php index 07831cf..8e91126 100644 --- a/tests/Feature/ProductFillWeightTest.php +++ b/tests/Feature/ProductFillWeightTest.php @@ -111,3 +111,28 @@ test('AP-52: verpackungsvorschau liefert bestand und lagerort je verpackungsarti ->and(substr_count($html, 'Lagerort'))->toBe(2) ->and($html)->not->toContain('Ablage'); }); + +test('AP-47: checkbox „produktionsrelevant" im produktformular wird gespeichert und steuert die produktions-auswahl', function () { + $this->actingAs(fwUser(), 'user'); + + // Neuanlage ohne Häkchen (Hidden-Fallback 0) => Zukaufartikel wie Aloe verschwindet aus der Planung. + $this->post(route('admin_product_store'), ['id' => 'new', 'name' => 'AP47-Aloe-Zukauf', 'active' => 1, 'production_relevant' => '0']) + ->assertRedirect()->assertSessionHasNoErrors(); + $product = Product::query()->where('name', 'AP47-Aloe-Zukauf')->firstOrFail(); + expect($product->production_relevant)->toBeFalse(); + + $html = $this->get(route('admin.inventory.productions.create'))->assertSuccessful()->getContent(); + $planningSelect = substr($html, strpos($html, 'id="product_id"')); + $planningSelect = substr($planningSelect, 0, strpos($planningSelect, '')); + expect($planningSelect)->not->toContain('AP47-Aloe-Zukauf'); + + // Häkchen wieder setzen => wieder wählbar. + $this->post(route('admin_product_store'), ['id' => $product->id, 'name' => 'AP47-Aloe-Zukauf', 'active' => 1, 'production_relevant' => '1']) + ->assertSessionHasNoErrors(); + expect($product->fresh()->production_relevant)->toBeTrue(); + + $html = $this->get(route('admin.inventory.productions.create'))->assertSuccessful()->getContent(); + $planningSelect = substr($html, strpos($html, 'id="product_id"')); + $planningSelect = substr($planningSelect, 0, strpos($planningSelect, '')); + expect($planningSelect)->toContain('AP47-Aloe-Zukauf'); +});