feat: allow duplicate resource names, show the room next to the name

This commit is contained in:
fromme committed 2026-09-17 18:40:53 +02:00
1 parent 84724879c7
commit d37d8bc786
8 files changed
+39 -21

No files matched your search

@@ -82,28 +82,18 @@ class ResourceAdminControllerTest extends WebTestCase
self::assertTrue($created->isActive());
}
public function testADuplicateLabelIsRejectedInTheModal(): void
/**
* Labels are not unique: two desks may both be called "Schreibtisch 01", e.g. in different rooms.
*/
public function testADuplicateLabelIsAccepted(): void
{
$this->resource('Schreibtisch 01');
$this->client->loginUser($this->admin());
$response = $this->submit('/admin/resources/new/desk', 'resource_form', ['label' => 'Schreibtisch 01']);
self::assertSame(Response::HTTP_UNPROCESSABLE_ENTITY, $response->getStatusCode());
self::assertStringContainsString('bereits vergeben', (string) $response->getContent());
}
/**
* The same label is fine for another type -- uniqueness is per type, like the database's.
*/
public function testTheSameLabelMayExistForAnotherType(): void
{
$this->resource('A1');
$this->client->loginUser($this->admin());
$response = $this->submit('/admin/resources/new/parking', 'resource_form', ['label' => 'A1']);
self::assertSame('/admin/resources', $response->headers->get('HX-Redirect'));
self::assertCount(2, $this->em->getRepository(Resource::class)->findBy(['label' => 'Schreibtisch 01']));
}
/**