public function sendTestNotificationAction(NotificationConfiguration $configuration)
 {
     $this->assertUserRights(UserRole::ROLE_ADMIN);
     $system = new System();
     $system->setName('TEST_SYSTEM');
     $system->setUrl('http://www.koalamon.com');
     $system->setIdentifier('TEST_NOTIFICATION_SYSTEM_IDENTIFIER');
     $tool = new Tool();
     $tool->setName('TEST_NOTIFICATION');
     $tool->setIdentifier('TEST_NOTIFICATION_TOOL_IDENTIFIER');
     $eventIdentifier = new EventIdentifier();
     $eventIdentifier->setProject($this->getProject());
     $eventIdentifier->setTool($tool);
     $eventIdentifier->setIdentifier('TEST_NOTIFICATION_EVENT_IDENTIFIER');
     $eventIdentifier->setSystem($system);
     $eventIdentifier->setCurrentState(Event::STATUS_FAILURE);
     $event = new Event();
     $event->setStatus(Event::STATUS_FAILURE);
     $event->setMessage('This is a test notification send by ' . $this->getUser()->getUsername() . '.');
     $event->setEventIdentifier($eventIdentifier);
     $event->setType($tool->getIdentifier());
     $notificationSender = new EventListener($this->container);
     $notificationSender->sendNotification($configuration, $event);
     return new JsonResponse(['status' => 'success', 'message' => 'Test notification was send.', 'configId' => $configuration->getId()]);
 }
 public function findByTool(Project $project, Tool $tool)
 {
     $qb = $this->createQueryBuilder('nc');
     $qb->join('nc.connectedTools', 't');
     $qb->where($qb->expr()->andX('nc.project = :project', 'nc.notifyAll = true'));
     $qb->orWhere($qb->expr()->andX('nc.project = :project', 't.id = :toolId'));
     $qb->setParameter('project', $project);
     $qb->setParameter('toolId', $tool->getId());
     return $qb->getQuery()->getResult();
 }