当前位置: 首页>>代码示例>>PHP>>正文


PHP PHPUnit_Runner_Version类代码示例

本文整理汇总了PHP中PHPUnit_Runner_Version的典型用法代码示例。如果您正苦于以下问题:PHP PHPUnit_Runner_Version类的具体用法?PHP PHPUnit_Runner_Version怎么用?PHP PHPUnit_Runner_Version使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了PHPUnit_Runner_Version类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: execute

 public function execute(InputInterface $input, OutputInterface $output)
 {
     $options = $input->getOptions();
     if ($input->getArgument('test')) {
         $options['steps'] = true;
     }
     $suite = $input->getArgument('suite');
     $test = $input->getArgument('test');
     $codecept = new \Codeception\Codecept((array) $options);
     $suites = $suite ? array($suite) : \Codeception\Configuration::suites();
     $output->writeln(\Codeception\Codecept::versionString() . "\nPowered by " . \PHPUnit_Runner_Version::getVersionString());
     if ($suite and $test) {
         $codecept->runSuite($suite, $test);
     }
     if (!$test) {
         foreach ($suites as $suite) {
             $codecept->runSuite($suite);
         }
     }
     $codecept->printResult();
     if (!$input->getOption('no-exit')) {
         if ($codecept->getResult()->failureCount() or $codecept->getResult()->errorCount()) {
             exit(1);
         }
     }
 }
开发者ID:BatVane,项目名称:Codeception,代码行数:26,代码来源:Run.php

示例2: setUp

 public function setUp()
 {
     if (version_compare('3.6.0', PHPUnit_Runner_Version::id()) == 1) {
         $this->markTestSkipped('The tested class is not compatible with current version of PHPUnit.');
     }
     $this->constraint = new Phake_PHPUnit_VerifierResultConstraintV3d6();
 }
开发者ID:svpernova09,项目名称:Phake,代码行数:7,代码来源:VerifierResultConstraingV3d6Test.php

示例3: runAction

 /**
  * Should run tests in browser
  * @param null $filterClass
  */
 public function runAction($filterClass = null)
 {
     // Make sure PHPUnit is autoloaded
     require_once 'PHPUnit/Autoload.php';
     set_time_limit(3600);
     $version = \PHPUnit_Runner_Version::id();
     $kernel_dir = $this->container->getParameter('kernel.root_dir');
     chdir($kernel_dir);
     // This will force the printer class to be autoloaded by Symfony, before PHPUnit tries to (and does not) find it
     $printerClass = 'Goutte\\DoodleBundle\\Tools\\PHPUnit\\HtmlResultPrinter';
     if (!class_exists($printerClass)) {
         $printerClass = false;
     }
     $argv = array();
     $argv[] = 'phpunit';
     if ($filterClass) {
         $argv[] = '--filter';
         $argv[] = $filterClass;
     }
     if (version_compare($version, "3.6.0") >= 0) {
         if ($printerClass) {
             $argv[] = '--printer';
             $argv[] = $printerClass;
         }
         $_SERVER['argv'] = $argv;
         \PHPUnit_TextUI_Command::main(true);
     } else {
         ob_end_clean();
         echo '<pre>';
         $_SERVER['argv'] = $argv;
         \PHPUnit_TextUI_Command::main(false);
         echo '</pre>';
         exit;
     }
 }
开发者ID:WiiGe,项目名称:antoine.goutenoir.com,代码行数:39,代码来源:TestController.php

示例4: process

 /**
  * @param  PHPUnit_Framework_TestResult $result
  */
 public function process(PHPUnit_Framework_TestResult $result, $minLines = 5, $minMatches = 70)
 {
     $codeCoverage = $result->getCodeCoverageInformation();
     $summary = PHPUnit_Util_CodeCoverage::getSummary($codeCoverage);
     $files = array_keys($summary);
     $metrics = new PHPUnit_Util_Metrics_Project($files, $summary, TRUE, $minLines, $minMatches);
     $document = new DOMDocument('1.0', 'UTF-8');
     $document->formatOutput = TRUE;
     $cpd = $document->createElement('pmd-cpd');
     $cpd->setAttribute('version', 'PHPUnit ' . PHPUnit_Runner_Version::id());
     $document->appendChild($cpd);
     foreach ($metrics->getDuplicates() as $duplicate) {
         $xmlDuplication = $cpd->appendChild($document->createElement('duplication'));
         $xmlDuplication->setAttribute('lines', $duplicate['numLines']);
         $xmlDuplication->setAttribute('tokens', $duplicate['numTokens']);
         $xmlFile = $xmlDuplication->appendChild($document->createElement('file'));
         $xmlFile->setAttribute('path', $duplicate['fileA']->getPath());
         $xmlFile->setAttribute('line', $duplicate['firstLineA']);
         $xmlFile = $xmlDuplication->appendChild($document->createElement('file'));
         $xmlFile->setAttribute('path', $duplicate['fileB']->getPath());
         $xmlFile->setAttribute('line', $duplicate['firstLineB']);
         $xmlDuplication->appendChild($document->createElement('codefragment', PHPUnit_Util_XML::prepareString(join('', array_slice($duplicate['fileA']->getLines(), $duplicate['firstLineA'] - 1, $duplicate['numLines'])))));
     }
     $this->write($document->saveXML());
     $this->flush();
 }
开发者ID:kdambekalns,项目名称:framework-benchs,代码行数:29,代码来源:CPD.php

示例5: checkVersion

 public static function checkVersion()
 {
     try {
         // For PHPUnit < 3.7
         if (is_file('PHPUnit/Runner/Version.php') && is_readable('PHPUnit/Runner/Version.php')) {
             include_once 'PHPUnit/Runner/Version.php';
             $actualVersion = PHPUnit_Runner_Version::id();
         } elseif (method_exists('PHPUnit_Runner_Version', 'id')) {
             $actualVersion = PHPUnit_Runner_Version::id();
         } else {
             // PHPUnit probably is not installed.
             throw new Exception();
         }
         if (version_compare($actualVersion, self::$phpUnitMinimumVersion) < 0) {
             echo "\n Zurmo tests are not working with PHPUnit {$actualVersion} \n";
             echo "PHPUnit version must be equal and higher then PHPUnit " . self::$phpUnitMinimumVersion . " and ";
             echo "lower then " . self::$phpUnitMaximumVersion . "\n";
             echo "Please upgrade your PHPUnit version \n\n";
             exit;
         }
         if (version_compare($actualVersion, self::$phpUnitMaximumVersion) >= 0) {
             echo "\n Zurmo tests are not working with PHPUnit {$actualVersion} \n";
             echo "PHPUnit version must be equal and higher then PHPUnit " . self::$phpUnitMinimumVersion . " and ";
             echo "lower then " . self::$phpUnitMaximumVersion . "\n";
             echo "Please downgrade your PHPUnit version \n\n";
             exit;
         }
         return;
     } catch (Exception $e) {
         echo "You must install PHPUnit, before running tests";
         exit;
     }
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:33,代码来源:PhpUnitServiceUtil.php

示例6: init

 /**
  * Initialize Task.
  * This method includes any necessary PHPUnit2 libraries and triggers
  * appropriate error if they cannot be found.  This is not done in header
  * because we may want this class to be loaded w/o triggering an error.
  */
 function init()
 {
     if (version_compare(PHP_VERSION, '5.0.3') < 0) {
         throw new BuildException("PHPUnit2Task requires PHP version >= 5.0.3.", $this->getLocation());
     }
     /**
      * Determine PHPUnit version number
      */
     @(include_once 'PHPUnit/Runner/Version.php');
     @(include_once 'PHPUnit2/Runner/Version.php');
     if (class_exists('PHPUnit_Runner_Version')) {
         $version = PHPUnit_Runner_Version::id();
     } elseif (class_exists('PHPUnit2_Runner_Version')) {
         $version = PHPUnit2_Runner_Version::id();
     } else {
         throw new BuildException("PHPUnit task depends on PHPUnit 2 or 3 package being installed.", $this->getLocation());
     }
     if (version_compare($version, "3.0.0") >= 0) {
         PHPUnitUtil::$installedVersion = 3;
         if (version_compare($version, "3.2.0") >= 0) {
             PHPUnitUtil::$installedMinorVersion = 2;
         }
     } else {
         PHPUnitUtil::$installedVersion = 2;
     }
     /**
      * Other dependencies that should only be loaded when class is actually used.
      */
     require_once 'phing/tasks/ext/phpunit/PHPUnitTestRunner.php';
     require_once 'phing/tasks/ext/phpunit/BatchTest.php';
     require_once 'phing/tasks/ext/phpunit/FormatterElement.php';
     /**
      * Add some defaults to the PHPUnit filter
      */
     if (PHPUnitUtil::$installedVersion == 3) {
         require_once 'PHPUnit/Framework.php';
         require_once 'PHPUnit/Util/Filter.php';
         // point PHPUnit_MAIN_METHOD define to non-existing method
         if (!defined('PHPUnit_MAIN_METHOD')) {
             define('PHPUnit_MAIN_METHOD', 'PHPUnitTask::undefined');
         }
         PHPUnit_Util_Filter::addFileToFilter('PHPUnitTask.php', 'PHING');
         PHPUnit_Util_Filter::addFileToFilter('PHPUnitTestRunner.php', 'PHING');
         PHPUnit_Util_Filter::addFileToFilter('phing/Task.php', 'PHING');
         PHPUnit_Util_Filter::addFileToFilter('phing/Target.php', 'PHING');
         PHPUnit_Util_Filter::addFileToFilter('phing/Project.php', 'PHING');
         PHPUnit_Util_Filter::addFileToFilter('phing/Phing.php', 'PHING');
         PHPUnit_Util_Filter::addFileToFilter('phing.php', 'PHING');
     } else {
         require_once 'PHPUnit2/Framework.php';
         require_once 'PHPUnit2/Util/Filter.php';
         PHPUnit2_Util_Filter::addFileToFilter('PHPUnitTask.php');
         PHPUnit2_Util_Filter::addFileToFilter('PHPUnitTestRunner.php');
         PHPUnit2_Util_Filter::addFileToFilter('phing/Task.php');
         PHPUnit2_Util_Filter::addFileToFilter('phing/Target.php');
         PHPUnit2_Util_Filter::addFileToFilter('phing/Project.php');
         PHPUnit2_Util_Filter::addFileToFilter('phing/Phing.php');
         PHPUnit2_Util_Filter::addFileToFilter('phing.php');
     }
 }
开发者ID:andrew-ejov,项目名称:start-template,代码行数:66,代码来源:PHPUnitTask.php

示例7: validateCallable

 /**
  * @param $funcName
  * @throws \BadMethodCallException
  */
 protected function validateCallable($funcName)
 {
     if (!is_callable([self::ASSERT_CLASS, $funcName])) {
         $m = $funcName . ' is not found in ' . self::ASSERT_CLASS . '. your phpunit version is ' . \PHPUnit_Runner_Version::id();
         throw new \BadMethodCallException($m);
     }
 }
开发者ID:gong023,项目名称:assert_chain,代码行数:11,代码来源:Container.php

示例8: init

 /**
  * Initialize Task.
  * This method includes any necessary PHPUnit libraries and triggers
  * appropriate error if they cannot be found.  This is not done in header
  * because we may want this class to be loaded w/o triggering an error.
  */
 public function init()
 {
     /**
      * Determine PHPUnit version number
      */
     @(include_once 'PHPUnit/Runner/Version.php');
     if (!class_exists('PHPUnit_Runner_Version')) {
         throw new BuildException("PHPUnitTask requires PHPUnit to be installed", $this->getLocation());
     }
     $version = PHPUnit_Runner_Version::id();
     if (version_compare($version, '3.6.0') < 0) {
         throw new BuildException("PHPUnitTask requires PHPUnit version >= 3.6.0", $this->getLocation());
     }
     /**
      * Other dependencies that should only be loaded when class is actually used.
      */
     require_once 'phing/tasks/ext/phpunit/PHPUnitTestRunner.php';
     require_once 'phing/tasks/ext/phpunit/BatchTest.php';
     require_once 'phing/tasks/ext/phpunit/FormatterElement.php';
     /**
      * point PHPUnit_MAIN_METHOD define to non-existing method
      */
     if (!defined('PHPUnit_MAIN_METHOD')) {
         define('PHPUnit_MAIN_METHOD', 'PHPUnitTask::undefined');
     }
 }
开发者ID:namesco,项目名称:phing,代码行数:32,代码来源:PHPUnitTask.php

示例9: init

 /**
  * Initialize Task.
  * This method includes any necessary PHPUnit2 libraries and triggers
  * appropriate error if they cannot be found.  This is not done in header
  * because we may want this class to be loaded w/o triggering an error.
  */
 public function init()
 {
     if (version_compare(PHP_VERSION, '5.0.3') < 0) {
         throw new BuildException("PHPUnitTask requires PHP version >= 5.0.3", $this->getLocation());
     }
     /**
      * Determine PHPUnit version number
      */
     @(include_once 'PHPUnit/Runner/Version.php');
     $version = PHPUnit_Runner_Version::id();
     if (version_compare($version, '3.2.0') < 0) {
         throw new BuildException("PHPUnitTask requires PHPUnit version >= 3.2.0", $this->getLocation());
     }
     /**
      * Other dependencies that should only be loaded when class is actually used.
      */
     require_once 'phing/tasks/ext/phpunit/PHPUnitTestRunner.php';
     require_once 'phing/tasks/ext/phpunit/BatchTest.php';
     require_once 'phing/tasks/ext/phpunit/FormatterElement.php';
     /**
      * Add some defaults to the PHPUnit filter
      */
     $pwd = dirname(__FILE__);
     require_once 'PHPUnit/Framework.php';
     require_once 'PHPUnit/Util/Filter.php';
     // point PHPUnit_MAIN_METHOD define to non-existing method
     if (!defined('PHPUnit_MAIN_METHOD')) {
         define('PHPUnit_MAIN_METHOD', 'PHPUnitTask::undefined');
     }
     $path = realpath($pwd . '/../../../');
     PHPUnit_Util_Filter::addDirectoryToFilter($path);
 }
开发者ID:halfer,项目名称:Meshing,代码行数:38,代码来源:PHPUnitTask.php

示例10: getPhpUnitVersion

 /**
  * Get PHPUnit version
  * @return string
  */
 protected static function getPhpUnitVersion()
 {
     if (method_exists('\\PHPUnit_Runner_Version', 'id')) {
         return \PHPUnit_Runner_Version::id();
     }
     return \PHPUnit_Runner_Version::VERSION;
 }
开发者ID:brianium,项目名称:paratest,代码行数:11,代码来源:TestBase.php

示例11: get_test_config

 public static function get_test_config()
 {
     $config = array();
     if (extension_loaded('sqlite') && version_compare(PHPUnit_Runner_Version::id(), '3.4.15', '>=')) {
         $config = array_merge($config, array('dbms' => 'sqlite', 'dbhost' => dirname(__FILE__) . '/../phpbb_unit_tests.sqlite2', 'dbport' => '', 'dbname' => '', 'dbuser' => '', 'dbpasswd' => ''));
     }
     if (isset($_SERVER['PHPBB_TEST_CONFIG'])) {
         // Could be an absolute path
         $test_config = $_SERVER['PHPBB_TEST_CONFIG'];
     } else {
         $test_config = dirname(__FILE__) . '/../test_config.php';
     }
     if (file_exists($test_config)) {
         include $test_config;
         $config = array_merge($config, array('dbms' => $dbms, 'dbhost' => $dbhost, 'dbport' => $dbport, 'dbname' => $dbname, 'dbuser' => $dbuser, 'dbpasswd' => $dbpasswd, 'custom_dsn' => isset($custom_dsn) ? $custom_dsn : ''));
         if (isset($phpbb_functional_url)) {
             $config['phpbb_functional_url'] = $phpbb_functional_url;
         }
     }
     if (isset($_SERVER['PHPBB_TEST_DBMS'])) {
         $config = array_merge($config, array('dbms' => isset($_SERVER['PHPBB_TEST_DBMS']) ? $_SERVER['PHPBB_TEST_DBMS'] : '', 'dbhost' => isset($_SERVER['PHPBB_TEST_DBHOST']) ? $_SERVER['PHPBB_TEST_DBHOST'] : '', 'dbport' => isset($_SERVER['PHPBB_TEST_DBPORT']) ? $_SERVER['PHPBB_TEST_DBPORT'] : '', 'dbname' => isset($_SERVER['PHPBB_TEST_DBNAME']) ? $_SERVER['PHPBB_TEST_DBNAME'] : '', 'dbuser' => isset($_SERVER['PHPBB_TEST_DBUSER']) ? $_SERVER['PHPBB_TEST_DBUSER'] : '', 'dbpasswd' => isset($_SERVER['PHPBB_TEST_DBPASSWD']) ? $_SERVER['PHPBB_TEST_DBPASSWD'] : '', 'custom_dsn' => isset($_SERVER['PHPBB_TEST_CUSTOM_DSN']) ? $_SERVER['PHPBB_TEST_CUSTOM_DSN'] : ''));
     }
     if (isset($_SERVER['PHPBB_FUNCTIONAL_URL'])) {
         $config = array_merge($config, array('phpbb_functional_url' => isset($_SERVER['PHPBB_FUNCTIONAL_URL']) ? $_SERVER['PHPBB_FUNCTIONAL_URL'] : ''));
     }
     return $config;
 }
开发者ID:josh-js,项目名称:phpbb,代码行数:27,代码来源:phpbb_test_case_helpers.php

示例12: testAdapterRunsPhpunitCommandWithAlltestsFileTarget

 public function testAdapterRunsPhpunitCommandWithAlltestsFileTarget()
 {
     $adapter = new \Mutateme\Adapter\Phpunit();
     $options = array('src' => dirname(__FILE__) . '/_files/phpunit2', 'tests' => dirname(__FILE__) . '/_files/phpunit2', 'base' => dirname(__FILE__) . '/_files/phpunit2', 'options' => 'AllMyTests.php');
     ob_start();
     $adapter->execute($options, true);
     $this->assertStringStartsWith(\PHPUnit_Runner_Version::getVersionString(), ob_get_clean());
 }
开发者ID:bergelmir,项目名称:mutateme,代码行数:8,代码来源:PhpunitAdapterTest.php

示例13: if_configuration_values_are_invalid_it_matches_when_exception_message_is_right_according_to_regexp

 /**
  * @test
  */
 public function if_configuration_values_are_invalid_it_matches_when_exception_message_is_right_according_to_regexp()
 {
     $constraint = new ConfigurationValuesAreInvalidConstraint(new ConfigurationWithRequiredValue(), '/required[_]{1}value/', true);
     if (version_compare(\PHPUnit_Runner_Version::id(), '4.2.0', '<')) {
         $this->setExpectedException('\\InvalidArgumentException', 'does not support matching exception messages by regular expression');
     }
     $this->assertTrue($constraint->evaluate(array(array()), '', true));
 }
开发者ID:helios-ag,项目名称:SymfonyConfigTest,代码行数:11,代码来源:ConfigurationValuesAreInvalidConstraintTest.php

示例14: setUp

 /**
  * Creates a predefined environment using the default environment
  *
  * Extending classes that have their own setUp() should call
  * parent::setUp()
  */
 public function setUp()
 {
     if (self::$_assert_type_compatability === NULL) {
         self::$_assert_type_compatability = version_compare(PHPUnit_Runner_Version::id(), '3.5.0', '<=');
     }
     $this->_helpers = new Kohana_Unittest_Helpers();
     $this->setEnvironment($this->environmentDefault);
 }
开发者ID:azuya,项目名称:Wi3,代码行数:14,代码来源:testcase.php

示例15: getConstraint

 private function getConstraint()
 {
     if (version_compare('3.6.0', PHPUnit_Runner_Version::id()) == 1) {
         return new Phake_PHPUnit_VerifierResultConstraint();
     } else {
         return new Phake_PHPUnit_VerifierResultConstraintV3d6();
     }
 }
开发者ID:eric-seekas,项目名称:Phake,代码行数:8,代码来源:PHPUnit.php


注:本文中的PHPUnit_Runner_Version类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。