20-02-2026

This commit is contained in:
Kevin Adametz 2026-02-20 17:57:50 +01:00
parent 854ce02bf6
commit 4d6b4930b2
128 changed files with 18247 additions and 2093 deletions

View file

@ -0,0 +1,24 @@
<?php
use App\Enums\ProductStatus;
test('product status has correct values', function () {
expect(ProductStatus::Draft->value)->toBe('draft');
expect(ProductStatus::Pending->value)->toBe('pending');
expect(ProductStatus::Correction->value)->toBe('correction');
expect(ProductStatus::Active->value)->toBe('active');
expect(ProductStatus::Archived->value)->toBe('archived');
expect(ProductStatus::Sold->value)->toBe('sold');
});
test('product status has labels', function () {
foreach (ProductStatus::cases() as $status) {
expect($status->label())->toBeString()->not->toBeEmpty();
}
});
test('product status has colors', function () {
foreach (ProductStatus::cases() as $status) {
expect($status->color())->toBeString()->not->toBeEmpty();
}
});

View file

@ -0,0 +1,47 @@
<?php
use App\Enums\PriceType;
use App\Enums\ProductType;
test('product type has correct values', function () {
expect(ProductType::LocalStock->value)->toBe('local_stock');
expect(ProductType::SmartOrder->value)->toBe('smart_order');
});
test('product type has labels', function () {
expect(ProductType::LocalStock->label())->toBeString()->not->toBeEmpty();
expect(ProductType::SmartOrder->label())->toBeString()->not->toBeEmpty();
});
test('product type can be created from value', function () {
expect(ProductType::from('local_stock'))->toBe(ProductType::LocalStock);
expect(ProductType::from('smart_order'))->toBe(ProductType::SmartOrder);
});
// Typ A Ticket zwingend (Teaser-Produkte: Beratungspflicht, Abschluss nur im Laden)
test('local stock requires ticket', function () {
expect(ProductType::LocalStock->requiresTicket())->toBeTrue();
});
// Typ B Ticket optional (Standard-Produkte: Direktkauf online möglich)
test('smart order does not require ticket', function () {
expect(ProductType::SmartOrder->requiresTicket())->toBeFalse();
});
// Typ A: Kein Festpreis online nur Ab-Preis oder Preis auf Anfrage
test('local stock only allows non-fixed price types', function () {
$allowed = ProductType::LocalStock->allowedPriceTypes();
expect($allowed)->toContain(PriceType::FromPrice)
->toContain(PriceType::OnRequest)
->not->toContain(PriceType::Fixed);
});
// Typ B: Alle Preistypen erlaubt
test('smart order allows all price types', function () {
$allowed = ProductType::SmartOrder->allowedPriceTypes();
expect($allowed)->toContain(PriceType::Fixed)
->toContain(PriceType::FromPrice)
->toContain(PriceType::OnRequest);
});

View file

@ -0,0 +1,13 @@
<?php
use App\Enums\UserOrigin;
test('user origin has correct values', function () {
expect(UserOrigin::Style2Own->value)->toBe('style2own');
expect(UserOrigin::StilEigentum->value)->toBe('stileigentum');
});
test('user origin has tonality', function () {
expect(UserOrigin::Style2Own->tonality())->toBe('du');
expect(UserOrigin::StilEigentum->tonality())->toBe('sie');
});