/**
  * {@inheritdoc}
  */
 public function __construct($out = null, $verbose = false, $colors = self::COLOR_DEFAULT, $debug = false, $numberOfColumns = 80)
 {
     parent::__construct($out, $verbose, $colors, $debug, $numberOfColumns);
     if ($numberOfColumns === 'max') {
         $console = new Console();
         $numberOfColumns = $console->getNumberOfColumns();
     }
     $this->maxNumberOfColumns = $numberOfColumns;
     $this->maxClassNameLength = intval($numberOfColumns * 0.6);
 }
Exemplo n.º 2
0
 /**
  * @covers \SebastianBergmann\Environment\Console::hasColorSupport
  */
 public function testCanDetectNumberOfColumns()
 {
     $this->assertInternalType('integer', $this->console->getNumberOfColumns());
 }
 /**
  * Constructor.
  *
  * @param mixed      $out
  * @param bool       $verbose
  * @param string     $colors
  * @param bool       $debug
  * @param int|string $numberOfColumns
  * @param bool       $reverse
  *
  * @throws PHPUnit_Framework_Exception
  *
  * @since  Method available since Release 3.0.0
  */
 public function __construct($out = null, $verbose = false, $colors = self::COLOR_DEFAULT, $debug = false, $numberOfColumns = 80, $reverse = false)
 {
     parent::__construct($out);
     if (!is_bool($verbose)) {
         throw PHPUnit_Util_InvalidArgumentHelper::factory(2, 'boolean');
     }
     $availableColors = [self::COLOR_NEVER, self::COLOR_AUTO, self::COLOR_ALWAYS];
     if (!in_array($colors, $availableColors)) {
         throw PHPUnit_Util_InvalidArgumentHelper::factory(3, vsprintf('value from "%s", "%s" or "%s"', $availableColors));
     }
     if (!is_bool($debug)) {
         throw PHPUnit_Util_InvalidArgumentHelper::factory(4, 'boolean');
     }
     if (!is_int($numberOfColumns) && $numberOfColumns != 'max') {
         throw PHPUnit_Util_InvalidArgumentHelper::factory(5, 'integer or "max"');
     }
     if (!is_bool($reverse)) {
         throw PHPUnit_Util_InvalidArgumentHelper::factory(6, 'boolean');
     }
     $console = new Console();
     $maxNumberOfColumns = $console->getNumberOfColumns();
     if ($numberOfColumns == 'max' || $numberOfColumns > $maxNumberOfColumns) {
         $numberOfColumns = $maxNumberOfColumns;
     }
     $this->numberOfColumns = $numberOfColumns;
     $this->verbose = $verbose;
     $this->debug = $debug;
     $this->reverse = $reverse;
     if ($colors === self::COLOR_AUTO && $console->hasColorSupport()) {
         $this->colors = true;
     } else {
         $this->colors = self::COLOR_ALWAYS === $colors;
     }
 }
Exemplo n.º 4
0
 /**
  * Constructor.
  *
  * @param  mixed                       $out
  * @param  boolean                     $verbose
  * @param  boolean                     $colors
  * @param  boolean                     $debug
  * @param  integer|string              $numberOfColumns
  * @throws PHPUnit_Framework_Exception
  * @since  Method available since Release 3.0.0
  */
 public function __construct($out = null, $verbose = false, $colors = false, $debug = false, $numberOfColumns = 80)
 {
     parent::__construct($out);
     if (!is_bool($verbose)) {
         throw PHPUnit_Util_InvalidArgumentHelper::factory(2, 'boolean');
     }
     if (!is_bool($colors)) {
         throw PHPUnit_Util_InvalidArgumentHelper::factory(3, 'boolean');
     }
     if (!is_bool($debug)) {
         throw PHPUnit_Util_InvalidArgumentHelper::factory(4, 'boolean');
     }
     if (!is_int($numberOfColumns) && $numberOfColumns != 'max') {
         throw PHPUnit_Util_InvalidArgumentHelper::factory(5, 'integer or "max"');
     }
     $console = new Console();
     $maxNumberOfColumns = $console->getNumberOfColumns();
     if ($numberOfColumns == 'max' || $numberOfColumns > $maxNumberOfColumns) {
         $numberOfColumns = $maxNumberOfColumns;
     }
     $this->numberOfColumns = $numberOfColumns;
     $this->verbose = $verbose;
     $this->colors = $colors && $console->hasColorSupport();
     $this->debug = $debug;
 }