/**
  * @test
  */
 public function ticketsAndRoomShouldBeUnavailable()
 {
     $this->inject($this->bookableService, 'configuration', [BookableService::TYPE_ROOM => ['fractionBase' => 12, 'availableQuota' => 10], BookableService::TYPE_TICKET => ['availableQuota' => 10]]);
     $bookables = $this->buildBookableRequest(10);
     $this->bookableService->requestRooms($bookables);
     $this->bookableService->requestTickets($bookables);
     $this->persistenceManager->persistAll();
     $this->assertEquals(0, $this->bookableService->getTicketsStatus());
     $this->assertEquals(0, $this->bookableService->getRoomStatus());
 }
 /**
  * @param Registration $registration
  */
 public function createAction(Registration $registration)
 {
     $pendingRegistration = $this->registrationRepository->findOneByAccountAndNotCompleted($this->securityContext->getAccount());
     if ($pendingRegistration !== NULL) {
         $this->view->assign('value', $this->dataTransferObjectFactory->getDataTransferObject($pendingRegistration));
         return;
     }
     $registrationLock = new \TYPO3\Flow\Utility\Lock\Lock('T3DD-Registration');
     $account = $this->securityContext->getAccount();
     $registrationEntity = $registration->getPayload();
     $registrationEntity->setAccount($account);
     $ticketRequest = [];
     $roomRequests = [];
     $participantPosition = 0;
     /** @var \T3DD\Backend\Domain\Model\Registration\Participant $participant */
     foreach ($registrationEntity->getParticipants() as $participant) {
         $participant->setPositionInRegistration($participantPosition++);
         $participant->setRegistration($registrationEntity);
         if ($participant->isRegistrant()) {
             $person = $this->partyService->getAssignedPartyOfAccount($account);
             $participant->setAccount($account);
             $participant->setPerson($person);
             if ($participant->getRoomSize() > 0) {
                 for ($i = 1; $i < $participant->getRoomSize(); $i++) {
                     $participant->addRoomMate(new \T3DD\Backend\Domain\Model\Registration\Mate());
                 }
             }
         }
         $ticketRequest[] = $participant->getTicketRequest();
         $roomRequest = $participant->getRoomRequest();
         if ($roomRequest !== NULL) {
             $roomRequests[] = $roomRequest;
         }
     }
     $this->bookableService->requestTickets($ticketRequest);
     $this->bookableService->requestRooms($roomRequests);
     $this->registrationRepository->add($registrationEntity);
     $this->persistenceManager->persistAll();
     $registrationLock->release();
     $this->view->assign('value', $registration);
 }