Example #1
0
 public function run(\Overwatch\TestBundle\Entity\Test $test)
 {
     $testResult = new TestResult();
     $testResult->setTest($test);
     try {
         $result = $this->get($test->getExpectation())->run($test->getActual(), $test->getExpected());
         $testResult->setStatus(ResultStatus::PASSED);
         $testResult->setInfo($result);
     } catch (\Exception $ex) {
         $result = $ex;
         $testResult->setInfo($ex->getMessage());
     }
     if ($result instanceof ExpectationException\ExpectationFailedException) {
         $testResult->setStatus(ResultStatus::FAILED);
     } else {
         if ($result instanceof ExpectationException\ExpectationUnsatisfactoryException) {
             $testResult->setStatus(ResultStatus::UNSATISFACTORY);
         } else {
             if ($result instanceof \Exception) {
                 $testResult->setStatus(ResultStatus::ERROR);
             }
         }
     }
     return $testResult;
 }
Example #2
0
 public function testShouldBeAlertedReturnsFalseWithSettingNone()
 {
     $this->user->setAlertSetting(AlertSetting::NONE);
     foreach (ResultStatus::getAll() as $status) {
         $result = new TestResult();
         $result->setStatus($status)->setInfo("Stahp shut up and take my money scumbag stacy trollface.");
         $this->assertFalse($this->user->shouldBeAlerted($result));
     }
 }
Example #3
0
 public function testIsAChange()
 {
     $oldResult = new TestResult();
     $oldResult->setStatus(ResultStatus::PASSED)->setTest($this->test);
     $this->test->addResult($oldResult);
     $this->result->setStatus(ResultStatus::PASSED)->setTest($this->test);
     $this->test->addResult($this->result);
     $this->assertFalse($this->result->isAChange());
     $newResult = new TestResult();
     $newResult->setStatus(ResultStatus::UNSATISFACTORY)->setTest($this->test);
     $this->test->addResult($newResult);
     $this->assertTrue($newResult->isAChange());
 }