/**
  * {@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);
 }
示例#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;
     }
 }
示例#4
0
 /**
  * Constructor
  *
  * @param  boolean $verbose
  * @param  boolean $colors
  * @param  boolean $debug
  * @throws \InvalidArgumentException
  */
 public function __construct($verbose = false, $colors = false, $debug = false)
 {
     if (!is_bool($verbose)) {
         throw new InvalidArgumentException('Expected $verbose to be of type boolean');
     }
     if (!is_bool($colors)) {
         throw new InvalidArgumentException('Expected $colors to be of type boolean');
     }
     if (!is_bool($debug)) {
         throw new InvalidArgumentException('Expected $debug to be of type boolean');
     }
     $this->debug = $debug;
     $this->verbose = $verbose;
     $console = new Console();
     $this->colors = $colors && $console->hasColorSupport();
 }
示例#5
0
 /**
  * @covers \SebastianBergmann\Environment\Console::hasColorSupport
  */
 public function testCanDetectColorSupport()
 {
     $this->markTestSkipped();
     $this->assertTrue($this->console->hasColorSupport());
 }
示例#6
0
 /**
  * Constructor.
  *
  * @param  mixed                       $out
  * @param  boolean                     $verbose
  * @param  boolean                     $colors
  * @param  boolean                     $debug
  * @throws PHPUnit_Framework_Exception
  * @since  Method available since Release 3.0.0
  */
 public function __construct($out = null, $verbose = false, $colors = false, $debug = false)
 {
     parent::__construct($out);
     if (is_bool($verbose)) {
         $this->verbose = $verbose;
     } else {
         throw PHPUnit_Util_InvalidArgumentHelper::factory(2, 'boolean');
     }
     if (is_bool($colors)) {
         $console = new Console();
         $this->colors = $colors && $console->hasColorSupport();
     } else {
         throw PHPUnit_Util_InvalidArgumentHelper::factory(3, 'boolean');
     }
     if (is_bool($debug)) {
         $this->debug = $debug;
     } else {
         throw PHPUnit_Util_InvalidArgumentHelper::factory(4, 'boolean');
     }
 }
示例#7
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;
 }