示例#1
0
 /**
  * Prints warning about unresolved dependencies
  *
  * @param string $class_names Unresolved classes and extensions names
  */
 public final function __construct($class_names)
 {
     $warning = new CliColor('red', ['bold']);
     $str = "WARNING!\nFound unresolved dependencies:\n\n";
     echo $warning->setString($str);
     $dependencies = new CliColor('white', ['bold']);
     echo $dependencies->setString("{$class_names}\n");
     $warning->setStyle(['default']);
     $str = "Please, install proper extensions for test completion.\n";
     echo $warning->setString($str);
 }
示例#2
0
 /**
  * Prints custom connection error message
  *
  * @param string $msg Error message
  */
 public final function __construct($msg)
 {
     $warning = new CliColor('red', ['bold']);
     $str = "Database connection error!\n{$msg}\n";
     echo $warning->setString($str);
 }
示例#3
0
 /**
  * Display results
  */
 public function showResults()
 {
     $results = $this->getResults();
     asort($results);
     $best = key($results);
     $string = new CliColor();
     printf($this->result_format, 'Test name', 'Repeats', 'Result', 'Performance');
     foreach ($results as $name => $value) {
         list($percent, $color) = $this->getPercentDiff($results[$best], $value);
         $value = number_format($value, 6);
         $string->setColor($color);
         $string->setString($value);
         printf($this->getFixedFormat(), $name, $this->getRepeats(), $string . ' sec', $percent . '%');
     }
 }
示例#4
0
 /**
  * Display results
  */
 public static final function showResults()
 {
     $results = self::getResults();
     asort($results);
     $best = key($results);
     $string = new CliColor();
     printf("%-16s%-16s%-16s%-16s\n", 'Test name', 'Repeats', 'Result', 'Performance');
     foreach ($results as $name => $value) {
         $color = $name === $best || $results[$best] === $value ? 'green' : 'red';
         $percent = self::getPercentDiff($results[$best], $value);
         $value = number_format($value, 6);
         $string->setColor($color);
         $string->setString($value);
         printf("%-16s%-16s%-27s%-16s\n", $name, self::getRepeats(), $string . ' sec', $percent . '%');
     }
 }
 /**
  * @covers Veles\Tools\CliColor::setString
  * @expectedException \Exception
  * @expectedExceptionMessage Not valid string!
  */
 public function testSetStringException()
 {
     $this->object->setString();
 }