Loheide-eu-mitarbeiterplatt.../tests/Unit/ColorPaletteTest.php
Friederich Loheide 5a3f1f34c7
Some checks failed
CI / PHP 8.4 / mariadb:10.6 (pull_request) Failing after 1m3s
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 1m7s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Failing after 1m16s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Failing after 1m20s
CI / PHP 8.4 / mysql:8.0 (pull_request) Successful in 1m29s
CI / PHP 8.3 / mysql:8.0 (pull_request) Successful in 1m33s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 1m28s
CI / PHP 8.3 / mysql:8.4 (pull_request) Successful in 1m33s
CI / Build-Artefakte aktuell (pull_request) Failing after 52s
Neues Design: Tailwind + shadcn-vue statt Vuetify/Material 3
- Nüchterne, professionelle Optik: neutrale Flächen, Markenfarbe nur als Akzent, Inter-Schrift (lokal)
- Zweizeiliger Header mit Suche, Hauptnavigation und Avatar-Menü
- Startseite mit Begrüßungskarte, Schnellzugriffen und „Neu im Team“
- Personenverzeichnis mit Suche, Abteilungsfilter und Seitenaufteilung
- Markenfarbe exakt übernommen, Abstufungen serverseitig in OKLCH (ColorPalette) –
  gemeinsam für Portal und Admin, keine Farbberechnung im Browser
- Schnellzugriffe im Admin pflegbar
- Filament-Avatare lokal statt über ui-avatars.com (DSGVO)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-25 20:51:53 +00:00

64 lines
1.8 KiB
PHP

<?php
namespace Tests\Unit;
use App\Support\ColorPalette;
use InvalidArgumentException;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
class ColorPaletteTest extends TestCase
{
/**
* @return array<string, array{string}>
*/
public static function brandColors(): array
{
return [
'Petrol' => ['#0F4C5C'],
'Magenta' => ['#E20074'],
'Gelb' => ['#F5C400'],
'Blau' => ['#2563EB'],
'Grau' => ['#666666'],
];
}
#[DataProvider('brandColors')]
public function test_brand_color_is_kept_exactly_on_shade_600(string $color): void
{
$palette = ColorPalette::fromHex($color);
$this->assertSame([50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950], array_keys($palette));
$this->assertSame(strtoupper($color), $palette[600]);
foreach ($palette as $hex) {
$this->assertMatchesRegularExpression('/^#[0-9A-F]{6}$/', $hex);
}
}
#[DataProvider('brandColors')]
public function test_shades_get_darker_from_50_to_950(string $color): void
{
$palette = array_values(ColorPalette::fromHex($color));
for ($i = 1; $i < count($palette); $i++) {
$this->assertGreaterThan(
ColorPalette::contrast($palette[$i - 1], '#FFFFFF'),
ColorPalette::contrast($palette[$i], '#FFFFFF'),
);
}
}
public function test_foreground_is_readable(): void
{
$this->assertSame('#FFFFFF', ColorPalette::foregroundFor('#0F4C5C'));
$this->assertSame('#111111', ColorPalette::foregroundFor('#F5C400'));
}
public function test_invalid_colors_are_rejected(): void
{
$this->expectException(InvalidArgumentException::class);
ColorPalette::fromHex('rot');
}
}