public function testCreate() { $id = new UUID(); $name = 'testRoom'; $seatCapacity = 2; $room = Room::create($id, $name, $seatCapacity); $this->roomRepositoryWithExpectedEvents($room->uncommittedEvents())->save($room, 0); $this->assertEquals($name, $room->name()); $this->assertEquals($seatCapacity, $room->seatCapacity()); $this->assertEquals(0, $room->bookedCapacity()); return $room; }
public function handle(CreateRoomCommand $command) { $room = Room::create(new UUID($command->roomId()), $command->name(), $command->seatCapacity()); $this->repository->save($room, $command->aggregateVersion()); }