示例#1
0
 /**
  * @Event("LiveTest.Run.HandleResult")
  */
 public function handleResult(Result $result)
 {
     static $counter = 1;
     $log = array($counter, $result->getStatus(), $result->getRequest()->getUri(), $result->getMessage());
     fputcsv($this->handle, $log, ';');
     $counter++;
 }
示例#2
0
 public function testGetter()
 {
     $test = new Test('name', 'className');
     $status = Result::STATUS_SUCCESS;
     $message = 'foo';
     $request = Symfony::create(new Uri('http://www.example.com/'));
     $result = new Result($test, $status, $message, $request, new MockUp(), 'mySession');
     $this->assertEquals($test, $result->getTest());
     $this->assertEquals($status, $result->getStatus());
     $this->assertEquals($message, $result->getMessage());
     $this->assertEquals($request->getUri(), $result->getRequest()->getUri());
 }
示例#3
0
 /**
  * This function writes the html documents to a specified directory
  *
  * @Event("LiveTest.Run.HandleResult")
  */
 public function handleResult(Result $result, Response $response)
 {
     if (in_array($result->getStatus(), $this->logStatuses)) {
         $filename = $this->logPath . urlencode($result->getRequest()->getIdentifier() . '.html');
         $file = new File($filename);
         $file->setContent($response->getBody());
         try {
             $this->createLogDirIfNotExists($this->logPath);
             $file->save();
         } catch (\Exception $e) {
             throw new ConfigurationException('Unable to write the html response to file "' . $filename . '"');
         }
     }
 }
示例#4
0
 /**
  * This function echoes a '*' if a test succeeded, 'e' if an error occured and 'f' if a test failed.
  *
  * @Event("LiveTest.Run.HandleResult")
  *
  * @param Result $result
  * @param Response $response
  */
 public function handleResult(Result $result, Response $response)
 {
     switch ($result->getStatus()) {
         case Result::STATUS_SUCCESS:
             $this->echoChar('*');
             break;
         case Result::STATUS_FAILED:
             $this->echoChar('f');
             break;
         case Result::STATUS_ERROR:
             $this->echoChar('e');
             break;
     }
 }
示例#5
0
 /**
  * @Event("LiveTest.Run.HandleResult")
  *
  * @param Result $result
  * @param Response $response
  */
 public function handleResult(Result $result, Response $response)
 {
     $this->testCount++;
     switch ($result->getStatus()) {
         case Result::STATUS_SUCCESS:
             $this->successCount++;
             break;
         case Result::STATUS_ERROR:
             $this->errorCount++;
             break;
         case Result::STATUS_FAILED:
             $this->failureCount++;
             break;
     }
 }
示例#6
0
 /**
  * Adds a result to the set
  *
  * @param Result $result
  */
 public function addResult(Result $result)
 {
     $this->status = max($this->statusWeight[$result->getStatus()], $this->status);
     $this->addElement($result);
 }
示例#7
0
 /**
  * Collect all information about all tests.
  *
  * @Event("LiveTest.Run.HandleResult")
  *
  * @param Result $result
  * @param Response $response
  */
 public function handleResult(Result $result, Response $response)
 {
     if (in_array($result->getStatus(), $this->logStatuses)) {
         $this->resultSet->addResult($result);
     }
 }