Example #1
0
 private function sendEmail(TestResult $result, array $users)
 {
     $message = \Swift_Message::newInstance()->setSubject($result->getTest()->getName() . " " . $result->getStatus())->setFrom($this->config['report_from'])->setTo($users)->setBody($this->container->get('templating')->render('OverwatchServiceBundle:Email:result.txt.twig', ["result" => $result]), 'text\\plain');
     $this->container->get('mailer')->send($message);
 }
Example #2
0
 /**
  * Should this user be alerted for the passed TestResult?
  * 
  * @param \Overwatch\ResultBundle\Entity\TestResult $result
  * @return bool
  */
 public function shouldBeAlerted(\Overwatch\ResultBundle\Entity\TestResult $result)
 {
     $setting = $this->getAlertSetting();
     if ($this->isLocked() || $setting === AlertSetting::NONE) {
         return false;
     }
     if (!$this->hasGroup($result->getTest()->getGroup()->getName())) {
         return false;
     }
     if ($setting === AlertSetting::ALL) {
         return true;
     }
     if ($result->isUnsuccessful() && $setting === AlertSetting::CHANGE_ALL) {
         return true;
     }
     if ($result->isAChange()) {
         if (in_array($setting, [AlertSetting::CHANGE, AlertSetting::CHANGE_ALL])) {
             return true;
         }
         if ($result->isUnsuccessful() && $setting === AlertSetting::CHANGE_BAD) {
             return true;
         }
     }
     return false;
 }