Warenwirtschaft: F-11 — Einkaufspreise auf der Rohstoff-Detailseite nur für Admins

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
Kevin Adametz 2026-09-08 11:04:07 +00:00
parent f93b16c8f7
commit 691f763011
3 changed files with 49 additions and 9 deletions

View file

@ -463,3 +463,35 @@ test('AP-37: enthalten-in listet ein produkt trotz doppelter rezeptzeilen nur ei
expect(substr_count($html, 'AP37-Zaubercreme-Unikat'))->toBe(1);
});
function f11Setup(): array
{
$admin = ap10MakeUser(7);
$location = Location::factory()->create();
$supplier = Supplier::factory()->create(['name' => 'F11-Lieferant']);
$ing = ap10MakeIngredient('F11-Preis');
$ing->suppliers()->attach($supplier->id, ['preferred' => true]);
ap10MakeStock($ing, $location, $supplier, $admin, ['price_per_kg' => 123.45]);
return [$admin, $ing];
}
test('F-11: copyreader sehen auf der rohstoff-detailseite keine einkaufspreise', function () {
[, $ing] = f11Setup();
$this->actingAs(ap10MakeUser(1), 'user')
->get(route('admin.inventory.raw-material-stock.show', $ing))
->assertSuccessful()
->assertSee('F11-Lieferant')
->assertDontSee('123,45')
->assertDontSee('Letzter Einkauf');
});
test('F-11: admins sehen den letzten einkaufspreis weiterhin', function () {
[$admin, $ing] = f11Setup();
$this->actingAs($admin, 'user')
->get(route('admin.inventory.raw-material-stock.show', $ing))
->assertSuccessful()
->assertSee('123,45');
});