refactor: use english for routes, parameters and internal messages

This commit is contained in:
fromme committed 2026-09-13 18:58:24 +02:00
1 parent bce8f58be3
commit a88ff7ff24
22 files changed
+106 -135

No files matched your search

+12 -20
View File
@@ -9,35 +9,27 @@ use PHPUnit\Framework\TestCase;
class ResourceTypeTest extends TestCase
{
public function testEverySlugResolvesBackToItsCase(): void
/**
* 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::fromSlug($type->slug()));
self::assertSame($type, ResourceType::tryFrom($type->value));
}
}
public function testSlugsAreUnique(): void
public function testAnUnknownValueResolvesToNothing(): void
{
$slugs = array_map(static fn (ResourceType $type): string => $type->slug(), ResourceType::cases());
self::assertSame($slugs, array_unique($slugs));
self::assertNull(ResourceType::tryFrom('bikes'));
}
public function testAnUnknownSlugIsRejected(): void
public function testValuesAreUrlSafe(): void
{
$this->expectException(\ValueError::class);
ResourceType::fromSlug('fahrraeder');
}
/**
* The URL slugs are German while the backing values stay English, because the values are
* persisted in resource.type and renaming them would need a migration.
*/
public function testTheSlugIsNotTheStoredValue(): void
{
self::assertSame('desk', ResourceType::DESK->value);
self::assertSame('schreibtische', ResourceType::DESK->slug());
foreach (ResourceType::cases() as $type) {
self::assertMatchesRegularExpression('/^[a-z]+$/', $type->value);
}
}
/**