feat: warn about overlapping bookings instead of refusing them

This commit is contained in:
fromme committed 2026-09-18 09:40:14 +02:00
1 parent fae28b1fd7
commit 5a6db29205
8 files changed
+359 -71

No files matched your search

+9 -4
View File
@@ -10,7 +10,6 @@ use App\Entity\Resource;
use App\Entity\User;
use App\Enum\RecurrenceRule;
use App\Enum\ResourceType;
use App\Exception\AlreadyHoldingResourceException;
use App\Exception\ResourceAlreadyBookedException;
use App\Model\TimeRange;
use App\Service\BookingManager;
@@ -69,13 +68,19 @@ class BookingManagerTest extends KernelTestCase
self::assertNotNull($second->getId());
}
public function testOnePersonMayNotHoldTwoDesksAtOnce(): void
/**
* This was a refusal once. It is allowed now -- the second desk is usually for the customer
* somebody is meeting -- and the overlap is reported as a flash instead, which
* BookingControllerTest covers.
*/
public function testOnePersonMayHoldTwoDesksAtOnce(): void
{
$user = $this->user('[email protected]');
$this->manager->book($user, $this->resource('D1'), $this->date(), TimeRange::fromMinutes(540, 780));
$this->expectException(AlreadyHoldingResourceException::class);
$this->manager->book($user, $this->resource('D2'), $this->date(), TimeRange::fromMinutes(600, 720));
$second = $this->manager->book($user, $this->resource('D2'), $this->date(), TimeRange::fromMinutes(600, 720));
self::assertNotNull($second->getId());
}
public function testOnePersonMayHoldTwoDesksAtDifferentTimes(): void