Warenwirtschaft: AP-47 — Regressionstest für die Checkbox „produktionsrelevant" über das Produktformular

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 <noreply@anthropic.com>
This commit is contained in:
Kevin Adametz 2026-09-09 15:01:31 +00:00
parent f22a382715
commit 2d5bc6518e

View file

@ -111,3 +111,28 @@ test('AP-52: verpackungsvorschau liefert bestand und lagerort je verpackungsarti
->and(substr_count($html, '<th>Lagerort</th>'))->toBe(2)
->and($html)->not->toContain('<th>Ablage</th>');
});
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, '</select>'));
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, '</select>'));
expect($planningSelect)->toContain('AP47-Aloe-Zukauf');
});