getPHPUnitConfiguration() 공개 메소드

Returns the PHPUnit configuration.
public getPHPUnitConfiguration ( ) : array
리턴 array
예제 #1
0
 private function bootstrap(InputInterface $input, \PHPUnit_Util_Configuration $config)
 {
     $bootstrap = $input->getOption('bootstrap');
     if (!$bootstrap && isset($config->getPHPUnitConfiguration()['bootstrap'])) {
         $bootstrap = $config->getPHPUnitConfiguration()['bootstrap'];
     }
     if ($bootstrap) {
         putenv('PHPUNIT_PARALLEL=master');
         dont_leak_env_and_include($bootstrap);
     }
 }
예제 #2
0
 /**
  * Asserts that the values in $actualConfiguration equal $expectedConfiguration.
  *
  * @param PHPUnit_Util_Configuration $expectedConfiguration
  * @param PHPUnit_Util_Configuration $actualConfiguration
  */
 protected function assertConfigurationEquals(PHPUnit_Util_Configuration $expectedConfiguration, PHPUnit_Util_Configuration $actualConfiguration)
 {
     $this->assertEquals($expectedConfiguration->getFilterConfiguration(), $actualConfiguration->getFilterConfiguration());
     $this->assertEquals($expectedConfiguration->getGroupConfiguration(), $actualConfiguration->getGroupConfiguration());
     $this->assertEquals($expectedConfiguration->getListenerConfiguration(), $actualConfiguration->getListenerConfiguration());
     $this->assertEquals($expectedConfiguration->getLoggingConfiguration(), $actualConfiguration->getLoggingConfiguration());
     $this->assertEquals($expectedConfiguration->getPHPConfiguration(), $actualConfiguration->getPHPConfiguration());
     $this->assertEquals($expectedConfiguration->getPHPUnitConfiguration(), $actualConfiguration->getPHPUnitConfiguration());
     $this->assertEquals($expectedConfiguration->getTestSuiteConfiguration(), $actualConfiguration->getTestSuiteConfiguration());
 }
예제 #3
0
파일: Command.php 프로젝트: cjmi/miniblog
 /**
  */
 protected static function handleArguments()
 {
     $arguments = array('listGroups' => FALSE, 'syntaxCheck' => TRUE);
     $longOptions = array('ansi', 'colors', 'bootstrap=', 'configuration=', 'coverage-html=', 'coverage-clover=', 'coverage-source=', 'coverage-xml=', 'debug', 'exclude-group=', 'filter=', 'group=', 'help', 'list-groups', 'loader=', 'log-graphviz=', 'log-json=', 'log-metrics=', 'log-pmd=', 'log-tap=', 'log-xml=', 'repeat=', 'report=', 'skeleton', 'skeleton-class', 'skeleton-test', 'stop-on-failure', 'story', 'story-html=', 'story-text=', 'tap', 'test-db-dsn=', 'test-db-log-rev=', 'test-db-log-prefix=', 'test-db-log-info=', 'testdox', 'testdox-html=', 'testdox-text=', 'no-syntax-check', 'verbose', 'version', 'wait');
     try {
         $options = PHPUnit_Util_Getopt::getopt($_SERVER['argv'], 'd:', $longOptions);
     } catch (RuntimeException $e) {
         PHPUnit_TextUI_TestRunner::showError($e->getMessage());
     }
     if (isset($options[1][0])) {
         $arguments['test'] = $options[1][0];
     }
     if (isset($options[1][1])) {
         $arguments['testFile'] = $options[1][1];
     } else {
         $arguments['testFile'] = '';
     }
     if (isset($arguments['test']) && is_file($arguments['test'])) {
         $arguments['testFile'] = realpath($arguments['test']);
         $arguments['test'] = substr($arguments['test'], 0, strrpos($arguments['test'], '.'));
     }
     foreach ($options[0] as $option) {
         switch ($option[0]) {
             case '--ansi':
             case '--colors':
                 $arguments['colors'] = TRUE;
                 break;
             case '--bootstrap':
                 $arguments['bootstrap'] = $option[1];
                 PHPUnit_Util_Fileloader::load($arguments['bootstrap']);
                 break;
             case '--configuration':
                 $arguments['configuration'] = $option[1];
                 break;
             case '--coverage-clover':
             case '--coverage-xml':
                 if (extension_loaded('tokenizer') && extension_loaded('xdebug')) {
                     $arguments['coverageClover'] = $option[1];
                 } else {
                     if (!extension_loaded('tokenizer')) {
                         self::showMissingDependency('The tokenizer extension is not loaded.');
                     } else {
                         self::showMissingDependency('The Xdebug extension is not loaded.');
                     }
                 }
                 break;
             case '--coverage-source':
                 if (extension_loaded('tokenizer') && extension_loaded('xdebug')) {
                     $arguments['coverageSource'] = $option[1];
                 } else {
                     if (!extension_loaded('tokenizer')) {
                         self::showMissingDependency('The tokenizer extension is not loaded.');
                     } else {
                         self::showMissingDependency('The Xdebug extension is not loaded.');
                     }
                 }
                 break;
             case '--coverage-html':
             case '--report':
                 if (extension_loaded('tokenizer') && extension_loaded('xdebug')) {
                     $arguments['reportDirectory'] = $option[1];
                 } else {
                     if (!extension_loaded('tokenizer')) {
                         self::showMissingDependency('The tokenizer extension is not loaded.');
                     } else {
                         self::showMissingDependency('The Xdebug extension is not loaded.');
                     }
                 }
                 break;
             case 'd':
                 $ini = explode('=', $option[1]);
                 if (isset($ini[0])) {
                     if (isset($ini[1])) {
                         ini_set($ini[0], $ini[1]);
                     } else {
                         ini_set($ini[0], TRUE);
                     }
                 }
                 break;
             case '--debug':
                 $arguments['debug'] = TRUE;
                 break;
             case '--help':
                 self::showHelp();
                 exit(PHPUnit_TextUI_TestRunner::SUCCESS_EXIT);
                 break;
             case '--filter':
                 $arguments['filter'] = $option[1];
                 break;
             case '--group':
                 $arguments['groups'] = explode(',', $option[1]);
                 break;
             case '--exclude-group':
                 $arguments['excludeGroups'] = explode(',', $option[1]);
                 break;
             case '--list-groups':
                 $arguments['listGroups'] = TRUE;
                 break;
             case '--loader':
                 self::handleLoader($option[1]);
                 break;
             case '--log-json':
                 $arguments['jsonLogfile'] = $option[1];
                 break;
             case '--log-graphviz':
                 if (PHPUnit_Util_Filesystem::fileExistsInIncludePath('Image/GraphViz.php')) {
                     $arguments['graphvizLogfile'] = $option[1];
                 } else {
                     self::showMissingDependency('The Image_GraphViz package is not installed.');
                 }
                 break;
             case '--log-tap':
                 $arguments['tapLogfile'] = $option[1];
                 break;
             case '--log-xml':
                 $arguments['xmlLogfile'] = $option[1];
                 break;
             case '--log-pmd':
                 if (extension_loaded('tokenizer') && extension_loaded('xdebug')) {
                     $arguments['pmdXML'] = $option[1];
                 } else {
                     if (!extension_loaded('tokenizer')) {
                         self::showMissingDependency('The tokenizer extension is not loaded.');
                     } else {
                         self::showMissingDependency('The Xdebug extension is not loaded.');
                     }
                 }
                 break;
             case '--log-metrics':
                 if (extension_loaded('tokenizer') && extension_loaded('xdebug')) {
                     $arguments['metricsXML'] = $option[1];
                 } else {
                     if (!extension_loaded('tokenizer')) {
                         self::showMissingDependency('The tokenizer extension is not loaded.');
                     } else {
                         self::showMissingDependency('The Xdebug extension is not loaded.');
                     }
                 }
                 break;
             case '--repeat':
                 $arguments['repeat'] = (int) $option[1];
                 break;
             case '--stop-on-failure':
                 $arguments['stopOnFailure'] = TRUE;
                 break;
             case '--test-db-dsn':
                 if (extension_loaded('pdo')) {
                     $arguments['testDatabaseDSN'] = $option[1];
                 } else {
                     self::showMissingDependency('The PDO extension is not loaded.');
                 }
                 break;
             case '--test-db-log-rev':
                 if (extension_loaded('pdo')) {
                     $arguments['testDatabaseLogRevision'] = $option[1];
                 } else {
                     self::showMissingDependency('The PDO extension is not loaded.');
                 }
                 break;
             case '--test-db-prefix':
                 if (extension_loaded('pdo')) {
                     $arguments['testDatabasePrefix'] = $option[1];
                 } else {
                     self::showMissingDependency('The PDO extension is not loaded.');
                 }
                 break;
             case '--test-db-log-info':
                 if (extension_loaded('pdo')) {
                     $arguments['testDatabaseLogInfo'] = $option[1];
                 } else {
                     self::showMissingDependency('The PDO extension is not loaded.');
                 }
                 break;
             case '--skeleton':
             case '--skeleton-class':
             case '--skeleton-test':
                 if (isset($arguments['test']) && $arguments['test'] !== FALSE) {
                     PHPUnit_TextUI_TestRunner::printVersionString();
                     if ($option[0] == '--skeleton-class') {
                         require_once 'PHPUnit/Util/Skeleton/Class.php';
                         $class = 'PHPUnit_Util_Skeleton_Class';
                     } else {
                         require_once 'PHPUnit/Util/Skeleton/Test.php';
                         $class = 'PHPUnit_Util_Skeleton_Test';
                     }
                     try {
                         $skeleton = new $class($arguments['test'], $arguments['testFile']);
                         $skeleton->write();
                     } catch (Exception $e) {
                         print $e->getMessage() . "\n";
                         printf('Could not skeleton for "%s" to "%s".' . "\n", $skeleton->getOutClassName(), $skeleton->getOutSourceFile());
                         exit(PHPUnit_TextUI_TestRunner::FAILURE_EXIT);
                     }
                     printf('Wrote skeleton for "%s" to "%s".' . "\n", $skeleton->getOutClassName(), $skeleton->getOutSourceFile());
                     exit(PHPUnit_TextUI_TestRunner::SUCCESS_EXIT);
                 } else {
                     self::showHelp();
                     exit(PHPUnit_TextUI_TestRunner::EXCEPTION_EXIT);
                 }
                 break;
             case '--tap':
                 require_once 'PHPUnit/Util/Log/TAP.php';
                 $arguments['printer'] = new PHPUnit_Util_Log_TAP();
                 break;
             case '--story':
                 require_once 'PHPUnit/Extensions/Story/ResultPrinter/Text.php';
                 $arguments['printer'] = new PHPUnit_Extensions_Story_ResultPrinter_Text();
                 break;
             case '--story-html':
                 $arguments['storyHTMLFile'] = $option[1];
                 break;
             case '--story-text':
                 $arguments['storyTextFile'] = $option[1];
                 break;
             case '--testdox':
                 require_once 'PHPUnit/Util/TestDox/ResultPrinter/Text.php';
                 $arguments['printer'] = new PHPUnit_Util_TestDox_ResultPrinter_Text();
                 break;
             case '--testdox-html':
                 $arguments['testdoxHTMLFile'] = $option[1];
                 break;
             case '--testdox-text':
                 $arguments['testdoxTextFile'] = $option[1];
                 break;
             case '--no-syntax-check':
                 $arguments['syntaxCheck'] = FALSE;
                 break;
             case '--verbose':
                 $arguments['verbose'] = TRUE;
                 break;
             case '--version':
                 PHPUnit_TextUI_TestRunner::printVersionString();
                 exit(PHPUnit_TextUI_TestRunner::SUCCESS_EXIT);
                 break;
             case '--wait':
                 $arguments['wait'] = TRUE;
                 break;
         }
     }
     if (!isset($arguments['configuration']) && file_exists('phpunit.xml')) {
         $arguments['configuration'] = realpath('phpunit.xml');
     }
     if (isset($arguments['configuration'])) {
         $configuration = new PHPUnit_Util_Configuration($arguments['configuration']);
         $browsers = $configuration->getSeleniumBrowserConfiguration();
         if (!empty($browsers)) {
             require_once 'PHPUnit/Extensions/SeleniumTestCase.php';
             PHPUnit_Extensions_SeleniumTestCase::$browsers = $browsers;
         }
         if (!isset($arguments['test'])) {
             $configuration->handlePHPConfiguration();
             if (!isset($arguments['bootstrap'])) {
                 $phpunitConfiguration = $configuration->getPHPUnitConfiguration();
                 if (isset($phpunitConfiguration['bootstrap'])) {
                     PHPUnit_Util_Fileloader::load($phpunitConfiguration['bootstrap']);
                 }
             }
             $testSuite = $configuration->getTestSuiteConfiguration();
             if ($testSuite !== NULL) {
                 $arguments['test'] = $testSuite;
             }
         }
     }
     if (isset($arguments['test']) && is_string($arguments['test']) && substr($arguments['test'], -5, 5) == '.phpt') {
         require_once 'PHPUnit/Extensions/PhptTestCase.php';
         $test = new PHPUnit_Extensions_PhptTestCase($arguments['test']);
         $arguments['test'] = new PHPUnit_Framework_TestSuite();
         $arguments['test']->addTest($test);
     }
     if (!isset($arguments['test']) || isset($arguments['testDatabaseLogRevision']) && !isset($arguments['testDatabaseDSN'])) {
         self::showHelp();
         exit(PHPUnit_TextUI_TestRunner::EXCEPTION_EXIT);
     }
     return $arguments;
 }
 /**
  * @param \PHPUnit_Util_Configuration $configuration $configuration
  *
  * @since Method available since Release 2.16.0
  */
 protected function earlyConfigure(\PHPUnit_Util_Configuration $configuration)
 {
     $configuration->handlePHPConfiguration();
     $phpunitConfiguration = $configuration->getPHPUnitConfiguration();
     if (array_key_exists('bootstrap', $phpunitConfiguration)) {
         if (array_key_exists('syntaxCheck', $phpunitConfiguration)) {
             $this->handleBootstrap($phpunitConfiguration['bootstrap'], $phpunitConfiguration['syntaxCheck']);
         } else {
             $this->handleBootstrap($phpunitConfiguration['bootstrap']);
         }
     }
     if (array_key_exists('colors', $phpunitConfiguration)) {
         $this->terminal->setColor($phpunitConfiguration['colors']);
     }
     if (method_exists($configuration, 'getSeleniumBrowserConfiguration') && class_exists('PHPUnit_Extensions_SeleniumTestCase')) {
         $seleniumBrowserConfiguration = $configuration->getSeleniumBrowserConfiguration();
         if (count($seleniumBrowserConfiguration) > 0) {
             \PHPUnit_Extensions_SeleniumTestCase::$browsers = $seleniumBrowserConfiguration;
         }
     }
 }