__construct() public method

Constructor.
public __construct ( mixed $out = NULL )
$out mixed
 /**
  * Constructor
  *
  * Parameter can be set in the phpunit xml configuration file:
  * <code>
  * <listeners>
  * 		<listener class="..." file="...">
  *			<arguments>
  * 				<string>...</string><!-- targetFile -->
  *
  * 				<string>...</string><!-- directory -->
  *
  * 				<array>
  * 					<element key="js/handle.gif">
  * 						<string>###MENTA_ROOTDIR###/PHPUnit/Listener/Resources/Templates/files/handle.gif</string>
  *					</element>
  * 					<element key="js/jquery.beforeafter-1.4.min.js">
  * 						<string>###MENTA_ROOTDIR###/PHPUnit/Listener/Resources/Templates/files/jquery.beforeafter-1.4.min.js</string>
  *					</element>
  *					<!-- ... -->
  * 				</array>
  * 			</arguments>
  * 		</listener>
  * </listeners>
  * </code>
  *
  * @param string $targetFile
  * @param string $templateFile
  * @param array $additionalFiles
  * @throws Exception
  * @author Fabrizio Branca
  */
 public function __construct($targetFile = NULL, $templateFile = NULL, array $additionalFiles = NULL)
 {
     if (!is_null($targetFile)) {
         $this->targetFile = $targetFile;
         $this->targetFile = Menta_Util_Div::replaceWithEnvironmentVariables($this->targetFile);
     }
     $dir = dirname($this->targetFile);
     if (!is_dir($dir)) {
         throw new Exception("Target dir '{$dir}' does not exist");
     }
     // clean target dir
     foreach (glob($dir . "/*") as $file) {
         if (!is_dir($file)) {
             unlink($file);
         }
     }
     if (!is_null($templateFile)) {
         $this->templateFile = $templateFile;
     }
     $this->templateFile = str_replace('###MENTA_ROOTDIR###', MENTA_ROOTDIR, $this->templateFile);
     if (empty($this->templateFile)) {
         throw new Exception('No template file defined');
     }
     if (!is_null($additionalFiles)) {
         $this->additionalFiles = $additionalFiles;
     }
     parent::__construct($this->targetFile);
 }
 public function __construct($out = null)
 {
     parent::__construct($out);
     self::$instance = $this;
     $this->setAutoFlush(true);
     $this->fd = fopen("php://fd/3", "w");
 }
示例#3
0
 /**
  * @param resource $out
  * @param array    $groups
  * @param array    $excludeGroups
  */
 public function __construct($out = null, array $groups = [], array $excludeGroups = [])
 {
     parent::__construct($out);
     $this->groups = $groups;
     $this->excludeGroups = $excludeGroups;
     $this->prettifier = new PHPUnit_Util_TestDox_NamePrettifier();
     $this->startRun();
 }
示例#4
0
 /**
  * Constructor.
  *
  * @param mixed $out
  * @param bool  $logIncompleteSkipped
  */
 public function __construct($out = null, $logIncompleteSkipped = false)
 {
     $this->document = new DOMDocument('1.0', 'UTF-8');
     $this->document->formatOutput = true;
     $this->root = $this->document->createElement('testsuites');
     $this->document->appendChild($this->root);
     parent::__construct($out);
     $this->logIncompleteSkipped = $logIncompleteSkipped;
 }
示例#5
0
文件: XML.php 项目: thanghexp/project
 /**
  * @param string|resource $out
  */
 public function __construct($out = null)
 {
     $this->document = new DOMDocument('1.0', 'UTF-8');
     $this->document->formatOutput = true;
     $this->root = $this->document->createElement('tests');
     $this->document->appendChild($this->root);
     $this->prettifier = new PHPUnit_Util_TestDox_NamePrettifier();
     parent::__construct($out);
 }
示例#6
0
 /**
  * Constructor.
  *
  * @param mixed $out
  * @param bool  $reportUselessTests
  */
 public function __construct($out = null, $reportUselessTests = false)
 {
     $this->document = new DOMDocument('1.0', 'UTF-8');
     $this->document->formatOutput = true;
     $this->root = $this->document->createElement('testsuites');
     $this->document->appendChild($this->root);
     parent::__construct($out);
     $this->reportUselessTests = $reportUselessTests;
 }
 /**
  * {@inheritDoc}
  */
 public function __construct($out = null)
 {
     parent::__construct($out);
     if ($this->isDebug()) {
         $level = LogLevel::DEBUG;
     } elseif ($this->isVerbose()) {
         $level = LogLevel::INFO;
     } else {
         $level = LogLevel::NOTICE;
     }
     $this->setLogger(new \Psr3ConsoleLogger('PHPUnitPrinterLogger', $level));
 }
示例#8
0
 /**
  * Constructor.
  *
  * @param  mixed   $out
  * @param  boolean $verbose
  * @param  boolean $colors
  * @param  boolean $debug
  * @throws InvalidArgumentException
  * @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)) {
         $this->colors = $colors;
     } else {
         throw \PHPUnit_Util_InvalidArgumentHelper::factory(3, 'boolean');
     }
     if (is_bool($debug)) {
         $this->debug = $debug;
     } else {
         throw \PHPUnit_Util_InvalidArgumentHelper::factory(4, 'boolean');
     }
 }
示例#9
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');
     }
 }
示例#10
0
 /**
  * Constructor.
  *
  * @param  mixed $out
  * @param  array $configuration
  * @throws InvalidArgumentException
  */
 public function __construct($out = NULL, array $configuration = array())
 {
     parent::__construct($out);
     $this->loadClasses($configuration);
 }
 /**
  * Constructor.
  *
  * @param  mixed $out
  */
 public function __construct($out = NULL)
 {
     if (PHPUnit_Util_Filesystem::fileExistsInIncludePath('Image/GraphViz.php')) {
         PHPUnit_Util_Filesystem::collectStart();
         require_once 'Image/GraphViz.php';
         $this->graph = new Image_GraphViz(TRUE, array('overlap' => 'scale', 'splines' => 'true', 'sep' => '.1', 'fontsize' => '8'));
         parent::__construct($out);
         foreach (PHPUnit_Util_Filesystem::collectEnd() as $blacklistedFile) {
             PHPUnit_Util_Filter::addFileToFilter($blacklistedFile, 'PHPUNIT');
         }
     } else {
         throw new RuntimeException('Image_GraphViz is not available.');
     }
 }
示例#12
0
 /**
  * Constructor.
  *
  * @param  mixed   $out
  * @param  boolean $verbose
  * @throws InvalidArgumentException
  * @access public
  * @since  Method available since Release 3.0.0
  */
 public function __construct($out = NULL, $verbose = FALSE)
 {
     parent::__construct($out);
     if (is_bool($verbose)) {
         $this->verbose = $verbose;
     } else {
         throw new InvalidArgumentException();
     }
 }
示例#13
0
 /**
  * Constructor.
  *
  * @param  mixed   $out
  * @param  boolean $verbose
  * @param  boolean $colors
  * @param  boolean $debug
  * @throws InvalidArgumentException
  * @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($colors)) {
         $this->colors = $colors;
     } else {
         throw new InvalidArgumentException();
     }
     if (is_bool($debug)) {
         $this->debug = $debug;
     } else {
         throw new InvalidArgumentException();
     }
     if (is_bool($verbose)) {
         $this->verbose = $verbose;
     } else {
         throw new InvalidArgumentException();
     }
 }
示例#14
0
 /**
  * Constructor.
  *
  * @param  mixed $out
  * @access public
  */
 public function __construct($out = NULL)
 {
     $this->graph = new Image_GraphViz(TRUE, array('overlap' => 'scale', 'splines' => 'true', 'sep' => '.1', 'fontsize' => '8'));
     parent::__construct($out);
 }
示例#15
0
 public function __construct($out = NULL, $verbose = FALSE, $colors = FALSE, $debug = FALSE)
 {
     parent::__construct($out);
 }
示例#16
0
 /**
  * Constructor
  *
  * @param array $options Configuration options
  */
 public function __construct(array $options = array())
 {
     $reqOptions = array('target', 'project-name', 'project-url', 'project-homepage', 'license-url', 'project-description', 'programming-language', 'developer-name', 'developer-url', 'developer-homepage');
     foreach ($reqOptions as $option) {
         if (false === isset($options[$option])) {
             throw new \InvalidArgumentException(sprintf('The "%s" option is not set', $option));
         }
     }
     $this->options = $options;
     $this->earlStatuses = array(\PHPUnit_Runner_BaseTestRunner::STATUS_PASSED => 'earl:passed', \PHPUnit_Runner_BaseTestRunner::STATUS_SKIPPED => 'earl:untested', \PHPUnit_Runner_BaseTestRunner::STATUS_INCOMPLETE => 'earl:cantTell', \PHPUnit_Runner_BaseTestRunner::STATUS_FAILURE => 'earl:failed', \PHPUnit_Runner_BaseTestRunner::STATUS_ERROR => 'earl:failed');
     $this->assertions = array();
     parent::__construct($options['target']);
 }
示例#17
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;
 }
 public function __construct()
 {
     parent::__construct(null);
     $this->handler = DeprecationErrorHandler::register();
 }
示例#19
0
 /**
  * Constructor.
  *
  * @param resource $out
  */
 public function __construct($out = null)
 {
     parent::__construct($out);
     $this->prettifier = new PHPUnit_Util_TestDox_NamePrettifier();
     $this->startRun();
 }
 /**
  * @param mixed                                                        $out
  * @param \Stagehand\TestRunner\JUnitXMLWriter\JUnitXMLWriterInterface $junitXMLWriter
  * @param \Stagehand\TestRunner\Core\TestTargetRepository              $testTargetRepository
  *
  * @since Method available since Release 3.3.0
  */
 public function __construct($out, JUnitXMLWriterInterface $junitXMLWriter, TestTargetRepository $testTargetRepository)
 {
     parent::__construct($out);
     $this->junitXMLWriter = $junitXMLWriter;
     $this->testTargetRepository = $testTargetRepository;
 }
 /**
  * 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;
     }
 }
示例#22
0
 /**
  * Constructor.
  *
  * @param  mixed $out
  */
 public function __construct($out = NULL)
 {
     if (PHPUnit_Util_Filesystem::fileExistsInIncludePath('Image/GraphViz.php')) {
         require_once 'Image/GraphViz.php';
     } else {
         throw new RuntimeException('Image_GraphViz is not available.');
     }
     $this->graph = new Image_GraphViz(TRUE, array('overlap' => 'scale', 'splines' => 'true', 'sep' => '.1', 'fontsize' => '8'));
     parent::__construct($out);
 }
示例#23
0
文件: TAP.php 项目: proofek/phpunit
 /**
  * Constructor.
  *
  * @param  mixed $out
  * @throws InvalidArgumentException
  * @since  Method available since Release 3.3.4
  */
 public function __construct($out = NULL)
 {
     parent::__construct($out);
     $this->write("TAP version 13\n");
 }
示例#24
0
文件: XML.php 项目: 453111208/bbc
 /**
  * Constructor.
  *
  * @param  mixed $out
  * @access public
  */
 public function __construct($out = NULL)
 {
     $this->document = new DOMDocument('1.0', 'UTF-8');
     $this->document->formatOutput = TRUE;
     $this->root = $this->document->createElement('testsuites');
     $this->document->appendChild($this->root);
     parent::__construct($out);
 }