chore: code cleanup

This commit is contained in:
fromme committed 2026-09-17 16:10:34 +02:00
1 parent 1a3640b15c
commit 5a01054b0e
65 files changed
+1046 -795

No files matched your search

+48
View File
@@ -0,0 +1,48 @@
<?php
declare(strict_types=1);
namespace App\Tests\Enum;
use App\Enum\ResourceType;
use PHPUnit\Framework\TestCase;
class ResourceTypeTest extends TestCase
{
/**
* The backing value is what appears in a URL, so it has to survive the round trip -- there
* is deliberately no separate slug mapping to keep in sync.
*/
public function testEveryValueResolvesBackToItsCase(): void
{
foreach (ResourceType::cases() as $type) {
self::assertSame($type, ResourceType::tryFrom($type->value));
}
}
public function testAnUnknownValueResolvesToNothing(): void
{
self::assertNull(ResourceType::tryFrom('bikes'));
}
public function testValuesAreUrlSafe(): void
{
foreach (ResourceType::cases() as $type) {
self::assertMatchesRegularExpression('/^[a-z]+$/', $type->value);
}
}
/**
* Every case must carry the presentation a dashboard tile needs, or adding one would produce
* a broken tile rather than a working one.
*/
public function testEveryCaseIsFullyDescribed(): void
{
foreach (ResourceType::cases() as $type) {
self::assertNotSame('', $type->label());
self::assertNotSame('', $type->plural());
self::assertNotSame('', $type->description());
self::assertStringStartsWith('lucide:', $type->icon());
}
}
}