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


PHP PHPUnit_TextUI_Command类代码示例

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


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

示例1: run

 /**
  * Call the same functions used by the CLI PHPUnit
  * to engage the tests
  * @param string $modulePath path to the phpunit.xml to use
  * @return int
  * 0: Tests successful
  * 1: Tests failed
  * 2: Failed with exception
  */
 public function run($modulePath, $params = array())
 {
     $runner = new \PHPUnit_TextUI_Command();
     $options = array('--configuration', $modulePath . '/phpunit.xml');
     if (isset($params['filter']) && !empty($params['filter'])) {
         $options[] = '--filter';
         $options[] = $params['filter'];
     }
     if (isset($params['coverage']) && !empty($params['coverage'])) {
         $coverage = $params['coverage'];
         $path = $this->getCoveragePath();
         switch ($coverage) {
             case 'html':
                 $options[] = '--coverage-html';
                 $path .= '/html';
                 $options[] = $path;
                 break;
             default:
                 $options[] = '--coverage-text';
                 break;
         }
         echo "Coverage data will be written to {$path}" . PHP_EOL;
     }
     array_unshift($options, 'phpunit');
     return $runner->run($options, false);
 }
开发者ID:linusshops,项目名称:prophet,代码行数:35,代码来源:TestRunner.php

示例2: runTests

 public function runTests()
 {
     $cliOptions = ['phpunit'];
     // first entry is the command
     array_push($cliOptions, '-c', __QCUBED_CORE__ . '/tests/phpunit.xml');
     // the config file is here
     //		array_push($cliOptions, '--bootstrap', __QCUBED_CORE__ . '/../vendor/autoload.php');
     $tester = new PHPUnit_TextUI_Command();
     $tester->run($cliOptions);
 }
开发者ID:vaibhav-kaushal,项目名称:qc-framework,代码行数:10,代码来源:test.php

示例3: execute

 public function execute()
 {
     global $IP;
     // NOTE (phuedx, 2014-03-26) wgAutoloadClasses isn't set up
     // by either of the dependencies at the top of the file, so
     // require it here.
     require_once __DIR__ . '/../tests/TestsAutoLoader.php';
     $textUICommand = new PHPUnit_TextUI_Command();
     $argv = array("{$IP}/tests/phpunit/phpunit.php", "{$IP}/tests/phpunit/suites/LessTestSuite.php");
     $textUICommand->run($argv);
 }
开发者ID:whysasse,项目名称:kmwiki,代码行数:11,代码来源:checkLess.php

示例4: execute

 /**
  * (non-PHPdoc)
  *
  * @see \SK\ITCBundle\Code\Generator\PHPUnit\AbstractGenerator::execute($input, $output)
  */
 public function execute(InputInterface $input, OutputInterface $output)
 {
     $this->writeHeader($output);
     if (strpos('/usr/bin/php', '@php_bin') === 0) {
         require dirname(__FILE__) . DIRECTORY_SEPARATOR . 'PHPUnit' . DIRECTORY_SEPARATOR . 'Autoload.php';
     } else {
         require '/usr/share/pear' . DIRECTORY_SEPARATOR . 'PHPUnit' . DIRECTORY_SEPARATOR . 'Autoload.php';
     }
     $commandArg = array('-c' => "phpunit.xml");
     $command = new \PHPUnit_TextUI_Command();
     $command->run($commandArg);
 }
开发者ID:slavomirkuzma,项目名称:itc-bundle,代码行数:17,代码来源:Run.php

示例5: run

 /**
  * Read configuration file, and run check.
  *
  * @return void
  * @throws \Exception
  */
 public function run()
 {
     if (is_null($this->config)) {
         exit("Can not find a set of checks to run.\n");
     }
     PHP_Timer::start();
     $command = new \PHPUnit_TextUI_Command();
     $command->run(array('--configuration', $this->config, '--testdox'), false);
     $duration = PHP_Timer::stop();
     $c = new Color();
     echo $c('Time : ' . PHP_Timer::secondsToTimeString($duration))->bold() . PHP_EOL;
 }
开发者ID:attachmentgenie,项目名称:testbench,代码行数:18,代码来源:TestRunner.php

示例6: phpunit

 /**
  * new method to launch a web server
  * @param array $options
  * @tutorial php bin/console server:run
  *           php bin/console server:run -a 192.168.0.1:8000
  */
 public function phpunit(array $options = array())
 {
     ob_get_clean();
     $files = scandir(__DIR__ . '/../../../../tests');
     foreach ($files as $one) {
         if (is_dir(__DIR__ . '/../../../../tests/' . $one) && $one != '..' && $one != '.') {
             $controllerFiles = scandir(__DIR__ . '/../../../../tests' . '/' . $one . '/app/Controller');
             foreach ($controllerFiles as $oneController) {
                 if (is_file(__DIR__ . '/../../../../tests/' . $one . '/app/Controller/' . $oneController) && $oneController != '..' && $oneController != '.') {
                     $unitTest = new \PHPUnit_TextUI_Command();
                     $unitTest->run([__DIR__ . '/../../../../tests/' . $one . '/app/Controller/' . $oneController]);
                 }
             }
         }
     }
 }
开发者ID:las93,项目名称:venus3,代码行数:22,代码来源:Phpunit.php

示例7: run

 /**
  * Runs PHPUnit.
  *
  * @return void
  */
 public function run()
 {
     require_once 'PHPUnit/Autoload.php';
     /** @var string */
     define('PHPUnit_MAIN_METHOD', 'PHPUnit_TextUI_Command::main');
     PHPUnit_TextUI_Command::main();
 }
开发者ID:chrmue01,项目名称:typo3-starter-kit,代码行数:12,代码来源:CliTestRunner.php

示例8: 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

示例9: main

 /**
  * Uses an instance of PHPUnit_TextUI_Command to execute the PHPUnit
  * tests and simulates any Mutagenesis supported command line options suitable
  * for PHPUnit. At present, we merely dissect a generic 'options' string
  * equivelant to anything typed into a console after a normal 'phpunit'
  * command. The adapter captures the TextUI output for further processing.
  *
  * To prevent duplication of output from stdout, PHPUnit is hard
  * configured to write to stderrm(stdin is used in proc_open call)
  *
  * @param array $arguments Mutagenesis arguments to pass to PHPUnit
  * @return void
  */
 public static function main(array $arguments, $useStdout = false)
 {
     if (!$useStdout) {
         array_unshift($arguments['clioptions'], '--stderr');
     }
     if (!in_array('--stop-on-failure', $arguments['clioptions'])) {
         array_unshift($arguments['clioptions'], '--stop-on-failure');
     }
     array_unshift($arguments['clioptions'], 'phpunit');
     $originalWorkingDirectory = getcwd();
     if (isset($arguments['tests'])) {
         chdir($arguments['tests']);
     }
     $command = new \PHPUnit_TextUI_Command();
     $command->run($arguments['clioptions'], false);
     chdir($originalWorkingDirectory);
 }
开发者ID:padraic,项目名称:mutagenesis,代码行数:30,代码来源:Runner.php

示例10: execute

 public function execute()
 {
     global $IP;
     // NOTE (phuedx, 2014-03-26) wgAutoloadClasses isn't set up
     // by either of the dependencies at the top of the file, so
     // require it here.
     require_once __DIR__ . '/../tests/TestsAutoLoader.php';
     // If phpunit isn't available by autoloader try pulling it in
     if (!class_exists('PHPUnit_Framework_TestCase')) {
         require_once 'PHPUnit/Autoload.php';
     }
     // RequestContext::resetMain() will print warnings unless this
     // is defined.
     if (!defined('MW_PHPUNIT_TEST')) {
         define('MW_PHPUNIT_TEST', true);
     }
     $textUICommand = new PHPUnit_TextUI_Command();
     $argv = ["{$IP}/tests/phpunit/phpunit.php", "{$IP}/tests/phpunit/suites/LessTestSuite.php"];
     $textUICommand->run($argv);
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:20,代码来源:checkLess.php

示例11: main

 /**
  * Uses an instance of PHPUnit_TextUI_Command to execute the PHPUnit
  * tests and simulates any Mutateme supported command line options suitable
  * for PHPUnit. At present, we merely dissect a generic 'options' string
  * equivelant to anything typed into a console after a normal 'phpunit'
  * command. The adapter captures the TextUI output for further processing.
  *
  * To prevent duplication of output from stdout, PHPUnit is hard
  * configured to write to stderrm(stdin is used in proc_open call)
  *
  * @param array $arguments Mutateme arguments to pass to PHPUnit
  * @return void
  */
 public static function main(array $arguments, $useStdout = false)
 {
     $optionString = 'phpunit';
     if ($useStdout) {
         $optionString .= '';
     } else {
         $optionString = ' --stderr';
     }
     if (isset($arguments['options'])) {
         $optionString .= ' ' . $arguments['options'];
     }
     $options = explode(' ', $optionString);
     $originalWorkingDirectory = getcwd();
     if (isset($arguments['tests'])) {
         chdir($arguments['tests']);
     }
     $command = new \PHPUnit_TextUI_Command();
     $command->run($options, false);
     chdir($originalWorkingDirectory);
 }
开发者ID:bergelmir,项目名称:mutateme,代码行数:33,代码来源:Runner.php

示例12: run

 /**
  * Runs PHPUnit.
  *
  * @return void
  */
 public function run()
 {
     // Store current TYPO3 configuration and set the default one
     // This is needed as the configuration might include closures which cannot be backed up
     $globalBackup = $this->removeClosures($GLOBALS['TYPO3_CONF_VARS']);
     // Run unit tests
     /** @var string */
     define('PHPUnit_MAIN_METHOD', 'PHPUnit_TextUI_Command::main');
     PHPUnit_TextUI_Command::main();
     // Restore configuration
     $GLOBALS['TYPO3_CONF_VARS'] = array_merge($GLOBALS['TYPO3_CONF_VARS'], $globalBackup);
 }
开发者ID:TrueType,项目名称:phpunit,代码行数:17,代码来源:CliTestRunner.php

示例13: showHelp

    protected function showHelp()
    {
        parent::showHelp();
        print <<<EOT
  --rerun                   Runs tests that failed on last execution.
EOT;
    }
开发者ID:KarlCOG,项目名称:cog-phpunit-rerun,代码行数:7,代码来源:RerunCommand.php

示例14: showHelp

    public function showHelp()
    {
        parent::showHelp();
        print <<<EOT

  --order <rand[:seed]>     Randomize the order of the tests. Optionally you can pass a seed to run a specific order.

EOT;
    }
开发者ID:hasumedic,项目名称:phpunit-randomizer,代码行数:9,代码来源:Command.php

示例15: handleArguments

 /**
  * {@inheritdoc}
  */
 protected function handleArguments(array $argv)
 {
     parent::handleArguments($argv);
     if (array_key_exists('testSuffixes', $this->arguments)) {
         $fileSystem = new FileSystem();
         $filePatterns = array();
         foreach ($this->arguments['testSuffixes'] as $testSuffix) {
             $filePatterns[] = preg_quote($testSuffix) . '$';
         }
         $this->testTargetRepository->setResources(array(empty($this->arguments['testFile']) ? $this->arguments['test'] : $this->arguments['testFile']));
         $this->testTargetRepository->setFilePattern(implode('|', $filePatterns));
     }
 }
开发者ID:piece,项目名称:stagehand-testrunner,代码行数:16,代码来源:Command.php


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