Exemple #1
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;
 }