/** * @test */ public function thatStores() { $entity = new EntityStub(); $this->em->expects($this->once())->method('persist')->with($this->equalTo($entity)); $this->em->expects($this->once())->method('flush'); $this->repository->store($entity); }
/** * @@param MoveTicketCommand $command * @return void * @throws \RuntimeException if unable to load required ticket */ public function moveTicket(MoveTicketCommand $command) { $ticket = $this->loadTicketById($command->id); $this->ticketHistoryRepository->store(new TicketHistory($ticket->getId(), $ticket->getKey())); $ticket->move($command->branch); $this->ticketRepository->store($ticket); //Remove old key from history to prevent loop redirects if ($oldHistory = $this->ticketHistoryRepository->findOneByTicketKey($ticket->getKey())) { $this->ticketHistoryRepository->remove($oldHistory); } $this->dispatchEvents($ticket); }