Exemplo n.º 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++;
 }
Exemplo n.º 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());
 }
Exemplo n.º 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 . '"');
         }
     }
 }
Exemplo n.º 4
0
 /**
  * Echoes the url that was tested.
  *
  * @Event("LiveTest.Run.HandleResult")
  *
  * @param Result $result
  * @param Response $response
  */
 public function handleResult(Result $result, Response $response)
 {
     if ($this->verbose) {
         echo "\n  HandleResult: - " . $result->getRequest()->getUri();
     }
 }