/**
  * @test
  */
 public function thatRemoves()
 {
     $entity = new EntityStub();
     $this->em->expects($this->once())->method('remove')->with($this->equalTo($entity));
     $this->em->expects($this->once())->method('flush');
     $this->repository->remove($entity);
 }
 /**
  * Delete Article
  * @param int $articleId
  * @return void
  */
 public function deleteArticle($articleId)
 {
     /** @var Article $article */
     $article = $this->repository->get($articleId);
     if (is_null($article)) {
         throw new ArticleNotFoundException();
     }
     $this->repository->remove($article);
 }
 /**
  * @@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);
 }