Beispiel #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++;
 }
Beispiel #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());
 }
 /**
  * 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 . '"');
         }
     }
 }
Beispiel #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;
     }
 }
Beispiel #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;
     }
 }
Beispiel #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);
 }
Beispiel #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);
     }
 }