本文整理汇总了PHP中PHPUnit_TextUI_Command::run方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPUnit_TextUI_Command::run方法的具体用法?PHP PHPUnit_TextUI_Command::run怎么用?PHP PHPUnit_TextUI_Command::run使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPUnit_TextUI_Command
的用法示例。
在下文中一共展示了PHPUnit_TextUI_Command::run方法的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);
}
示例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);
}
示例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);
}
示例4: 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;
}
示例5: 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);
}
示例6: run
public function run(array $argv, $exit = true)
{
wfProfileIn(__METHOD__);
$ret = parent::run($argv, false);
wfProfileOut(__METHOD__);
// Return to real wiki db, so profiling data is preserved
MediaWikiTestCase::teardownTestDB();
// Log profiling data, e.g. in the database or UDP
wfLogProfilingData();
if ($exit) {
exit($ret);
} else {
return $ret;
}
}
示例7: 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]);
}
}
}
}
}
示例8: 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);
}
示例9: 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);
}
示例10: 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);
}
示例11: run
/**
* @param array $argv
* @param boolean $exit
*/
public function run(array $argv, $exit = true)
{
parent::run($argv, false);
}
示例12: run
public function run($options)
{
$phpunit = new \PHPUnit_TextUI_Command();
$phpunit->run(['', 'tests/cases', '--bootstrap=tests/bootstrap.php']);
}
示例13: run_with_xml
/**
* Runs PHPUnit with the supplied XML configuration file.
*
* @param mixed $xml_config The path to the PHPUnit XML configuration
* file.
* @access public
* @return string
*/
public function run_with_xml($xml_config, $extraConfiguration)
{
$command = new \PHPUnit_TextUI_Command();
// We need to temporarily turn off html_errors to ensure correct
// parsing of test debug output
$html_errors = ini_get('html_errors');
ini_set('html_errors', 0);
ob_start();
if (isset($extraConfiguration['use_group_name'])) {
$command->run(array('--configuration', $xml_config, '--group', $extraConfiguration['use_group_name']), false);
} else {
if (isset($extraConfiguration['run_specific_test'])) {
$command->run(array('--configuration', $xml_config, '--filter', $extraConfiguration['run_specific_test']), false);
} else {
$command->run(array('--configuration', $xml_config), false);
}
}
$results = ob_get_contents();
ob_end_clean();
ini_set('html_errors', $html_errors);
$start = strpos($results, '{');
$end = strrpos($results, '}');
return substr($results, $start, $end - $start + 1);
}
示例14: run_with_xml
/**
* Runs PHPUnit with the supplied XML configuration file.
*
* @param mixed $xml_config The path to the PHPUnit XML configuration
* file.
* @access public
* @return string
*/
public function run_with_xml($xml_config)
{
$command = new \PHPUnit_TextUI_Command();
// We need to temporarily turn off html_errors to ensure correct
// parsing of test debug output
$html_errors = ini_get('html_errors');
ini_set('html_errors', 0);
ob_start();
$command->run(array('--configuration', $xml_config), false);
$results = ob_get_contents();
ob_end_clean();
ini_set('html_errors', $html_errors);
$start = strpos($results, '{');
$end = strrpos($results, '}');
return substr($results, $start, $end - $start + 1);
}
示例15: dirname
<?php
$base = dirname(__FILE__);
set_include_path("{$base}:{$base}/tests:" . get_include_path());
require_once 'PHPUnit/Util/Filter.php';
PHPUnit_Util_Filter::addFileToFilter(__FILE__, 'PHPUNIT');
require_once 'PHPUnit/TextUI/Command.php';
$command = new PHPUnit_TextUI_Command();
$command->run($argv);