コード例 #1
0
 /**
  * Adds an error to the list of errors.
  *
  * @param  PHPUnit_Framework_Test $test
  * @param  Exception              $e
  * @param  float                  $time
  */
 public function addError(PHPUnit_Framework_Test $test, Exception $e, $time)
 {
     $message = "\n" . $e->getMessage();
     if ($e instanceof PHPUnit_Framework_ExpectationFailedException) {
         /** @var $e PHPUnit_Framework_ExpectationFailedException */
         //$message .= "\n" . $e->getComparisonFailure()->toString();
     }
     $name = $test->getName(false);
     $mail = new Enlight_Components_Mail();
     $mail->addTo($this->mailRecipients);
     $mail->setSubject('PHPUnit test "' . $name . '" failed.');
     $mail->setBodyText($message);
     if ($test instanceof Enlight_Components_Test_Selenium_TestCase && $e instanceof PHPUnit_Framework_ExpectationFailedException && ($screenshot = $test->getFullScreenshot())) {
         $filename = basename($test->getFullScreenshotUrl());
         /** @var $test Enlight_Components_Test_Selenium_TestCase */
         $mail->createAttachment($screenshot, Zend_Mime::TYPE_OCTETSTREAM, Zend_Mime::DISPOSITION_ATTACHMENT, Zend_Mime::ENCODING_BASE64, $filename);
     }
     $mail->send($this->mailTransport);
 }