本文整理汇总了PHP中PHPUnit_Util_Getopt::getopt方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPUnit_Util_Getopt::getopt方法的具体用法?PHP PHPUnit_Util_Getopt::getopt怎么用?PHP PHPUnit_Util_Getopt::getopt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPUnit_Util_Getopt
的用法示例。
在下文中一共展示了PHPUnit_Util_Getopt::getopt方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testItIncludeTheShortOptionsAfterTheArgument
public function testItIncludeTheShortOptionsAfterTheArgument()
{
$args = array('command', 'myArgument', '-v');
$actual = PHPUnit_Util_Getopt::getopt($args, 'v');
$expected = array(array(array('v', null)), array('myArgument'));
$this->assertEquals($expected, $actual);
}
示例2: testItIncludeTheShortOptionsAfterTheArgument
public function testItIncludeTheShortOptionsAfterTheArgument()
{
$args = ['command', 'myArgument', '-v'];
$actual = PHPUnit_Util_Getopt::getopt($args, 'v');
$expected = [[['v', null]], ['myArgument']];
$this->assertEquals($expected, $actual);
}
示例3: _get_test_suite
function _get_test_suite()
{
$suite = '';
$opts = PHPUnit_Util_Getopt::getopt($GLOBALS['argv'], 'd:c:hv', array('filter=', 'testsuite='));
foreach ($opts[0] as $opt) {
if ('--testsuite' === $opt[0]) {
$suite = $opt[1];
break;
}
if ('--filter' === $opt[0] && false !== stripos($opt[1], 'unit')) {
$suite = 'unit';
break;
}
}
return strtolower($suite);
}
示例4: __construct
function __construct($argv)
{
$options = PHPUnit_Util_Getopt::getopt($argv, 'd:c:hv', array_keys($this->longOptions));
$ajax_message = true;
foreach ($options[0] as $option) {
switch ($option[0]) {
case '--exclude-group':
$ajax_message = false;
continue 2;
case '--group':
$groups = explode(',', $option[1]);
foreach ($groups as $group) {
if (is_numeric($group) || preg_match('/^(UT|Plugin)\\d+$/', $group)) {
WP_UnitTestCase::forceTicket($group);
}
}
$ajax_message = !in_array('ajax', $groups);
continue 2;
}
}
if ($ajax_message) {
echo "Not running ajax tests... To execute these, use --group ajax." . PHP_EOL;
}
}
示例5: handleArguments
/**
* Handles the command-line arguments.
*
* A child class of PHPUnit_TextUI_Command can hook into the argument
* parsing by adding the switch(es) to the $longOptions array and point to a
* callback method that handles the switch(es) in the child class like this
*
* <code>
* <?php
* class MyCommand extends PHPUnit_TextUI_Command
* {
* public function __construct()
* {
* $this->longOptions['--my-switch'] = 'myHandler';
* }
*
* // --my-switch foo -> myHandler('foo')
* protected function myHandler($value)
* {
* }
* }
* </code>
*
* @param array $argv
*/
protected function handleArguments(array $argv)
{
try {
$this->options = PHPUnit_Util_Getopt::getopt($argv, 'd:', array_keys($this->longOptions));
} catch (RuntimeException $e) {
PHPUnit_TextUI_TestRunner::showError($e->getMessage());
}
$skeletonClass = FALSE;
$skeletonTest = FALSE;
foreach ($this->options[0] as $option) {
switch ($option[0]) {
case '--ansi':
$this->showMessage('The --ansi option is deprecated, please use --colors ' . 'instead.', FALSE);
case '--colors':
$this->arguments['colors'] = TRUE;
break;
case '--bootstrap':
$this->arguments['bootstrap'] = $option[1];
break;
case '--configuration':
$this->arguments['configuration'] = $option[1];
break;
case '--coverage-xml':
$this->showMessage('The --coverage-xml option is deprecated, please use ' . '--coverage-clover instead.', FALSE);
case '--coverage-clover':
if (extension_loaded('tokenizer') && extension_loaded('xdebug')) {
$this->arguments['coverageClover'] = $option[1];
} else {
if (!extension_loaded('tokenizer')) {
$this->showMessage('The tokenizer extension is not loaded.');
} else {
$this->showMessage('The Xdebug extension is not loaded.');
}
}
break;
case '--coverage-source':
if (extension_loaded('tokenizer') && extension_loaded('xdebug')) {
$this->arguments['coverageSource'] = $option[1];
} else {
if (!extension_loaded('tokenizer')) {
$this->showMessage('The tokenizer extension is not loaded.');
} else {
$this->showMessage('The Xdebug extension is not loaded.');
}
}
break;
case '--report':
$this->showMessage('The --report option is deprecated, please use ' . '--coverage-html instead.', FALSE);
case '--coverage-html':
if (extension_loaded('tokenizer') && extension_loaded('xdebug')) {
$this->arguments['reportDirectory'] = $option[1];
} else {
if (!extension_loaded('tokenizer')) {
$this->showMessage('The tokenizer extension is not loaded.');
} else {
$this->showMessage('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':
$this->arguments['debug'] = TRUE;
break;
case '--help':
$this->showHelp();
exit(PHPUnit_TextUI_TestRunner::SUCCESS_EXIT);
//.........这里部分代码省略.........
示例6: handleArguments
/**
* Handles the command-line arguments.
*
* A child class of PHPUnit_TextUI_Command can hook into the argument
* parsing by adding the switch(es) to the $longOptions array and point to a
* callback method that handles the switch(es) in the child class like this
*
* <code>
* <?php
* class MyCommand extends PHPUnit_TextUI_Command
* {
* public function __construct()
* {
* $this->longOptions['--my-switch'] = 'myHandler';
* }
*
* // --my-switch foo -> myHandler('foo')
* protected function myHandler($value)
* {
* }
* }
* </code>
*
* @param array $argv
*/
protected function handleArguments(array $argv)
{
try {
$this->options = PHPUnit_Util_Getopt::getopt($argv, 'd:c:hv', array_keys($this->longOptions));
} catch (PHPUnit_Framework_Exception $e) {
PHPUnit_TextUI_TestRunner::showError($e->getMessage());
}
foreach ($this->options[0] as $option) {
switch ($option[0]) {
case '--colors':
$this->arguments['colors'] = TRUE;
break;
case '--bootstrap':
$this->arguments['bootstrap'] = $option[1];
break;
case 'c':
case '--configuration':
$this->arguments['configuration'] = $option[1];
break;
case '--coverage-clover':
case '--coverage-html':
case '--coverage-php':
case '--coverage-text':
if (!extension_loaded('tokenizer')) {
$this->showExtensionNotLoadedMessage('tokenizer', 'No code coverage will be generated.');
continue;
}
if (!extension_loaded('xdebug')) {
$this->showExtensionNotLoadedMessage('Xdebug', 'No code coverage will be generated.');
continue;
}
switch ($option[0]) {
case '--coverage-clover':
$this->arguments['coverageClover'] = $option[1];
break;
case '--coverage-html':
$this->arguments['reportDirectory'] = $option[1];
break;
case '--coverage-php':
$this->arguments['coveragePHP'] = $option[1];
break;
case '--coverage-text':
if ($option[1] === NULL) {
$option[1] = 'php://stdout';
}
$this->arguments['coverageText'] = $option[1];
$this->arguments['coverageTextShowUncoveredFiles'] = FALSE;
break;
}
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':
$this->arguments['debug'] = TRUE;
break;
case 'h':
case '--help':
$this->showHelp();
exit(PHPUnit_TextUI_TestRunner::SUCCESS_EXIT);
break;
case '--filter':
$this->arguments['filter'] = $option[1];
break;
case '--group':
$this->arguments['groups'] = explode(',', $option[1]);
break;
case '--exclude-group':
//.........这里部分代码省略.........
示例7: handleArguments
/**
* This function is cut&paste from PHPUnit_TextUI_Command::handleArguments
* Removed the need for a required unnamed command option ( 'test')
**/
protected function handleArguments(array $argv)
{
try {
$this->options = PHPUnit_Util_Getopt::getopt(
$argv,
'd:c:',
array_keys($this->longOptions)
);
}
catch (RuntimeException $e) {
PHPUnit_TextUI_TestRunner::showError($e->getMessage());
}
$skeletonClass = FALSE;
$skeletonTest = FALSE;
foreach ($this->options[0] as $option) {
switch ($option[0]) {
case '--colors': {
$this->arguments['colors'] = TRUE;
}
break;
case '--bootstrap': {
$this->arguments['bootstrap'] = $option[1];
}
break;
case 'c':
case '--configuration': {
$this->arguments['configuration'] = $option[1];
}
break;
case '--coverage-clover': {
if (extension_loaded('tokenizer') &&
extension_loaded('xdebug')) {
$this->arguments['coverageClover'] = $option[1];
} else {
if (!extension_loaded('tokenizer')) {
$this->showMessage(
'The tokenizer extension is not loaded.'
);
} else {
$this->showMessage(
'The Xdebug extension is not loaded.'
);
}
}
}
break;
case '--coverage-html': {
if (extension_loaded('tokenizer') &&
extension_loaded('xdebug')) {
$this->arguments['reportDirectory'] = $option[1];
} else {
if (!extension_loaded('tokenizer')) {
$this->showMessage(
'The tokenizer extension is not loaded.'
);
} else {
$this->showMessage(
'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': {
$this->arguments['debug'] = TRUE;
}
break;
case '--help': {
$this->showHelp();
exit(PHPUnit_TextUI_TestRunner::SUCCESS_EXIT);
}
break;
case '--filter': {
//.........这里部分代码省略.........
示例8: handleArguments
/**
* Handles the command-line arguments.
*
* A child class of PHPUnit_TextUI_Command can hook into the argument
* parsing by adding the switch(es) to the $longOptions array and point to a
* callback method that handles the switch(es) in the child class like this
*
* <code>
* <?php
* class MyCommand extends PHPUnit_TextUI_Command
* {
* public function __construct()
* {
* // my-switch won't accept a value, it's an on/off
* $this->longOptions['my-switch'] = 'myHandler';
* // my-secondswitch will accept a value - note the equals sign
* $this->longOptions['my-secondswitch='] = 'myOtherHandler';
* }
*
* // --my-switch -> myHandler()
* protected function myHandler()
* {
* }
*
* // --my-secondswitch foo -> myOtherHandler('foo')
* protected function myOtherHandler ($value)
* {
* }
*
* // You will also need this - the static keyword in the
* // PHPUnit_TextUI_Command will mean that it'll be
* // PHPUnit_TextUI_Command that gets instantiated,
* // not MyCommand
* public static function main($exit = true)
* {
* $command = new static;
*
* return $command->run($_SERVER['argv'], $exit);
* }
*
* }
* </code>
*
* @param array $argv
*/
protected function handleArguments(array $argv)
{
if (defined('__PHPUNIT_PHAR__')) {
$this->longOptions['check-version'] = null;
$this->longOptions['selfupdate'] = null;
$this->longOptions['self-update'] = null;
$this->longOptions['selfupgrade'] = null;
$this->longOptions['self-upgrade'] = null;
}
try {
$this->options = PHPUnit_Util_Getopt::getopt($argv, 'd:c:hv', array_keys($this->longOptions));
} catch (PHPUnit_Framework_Exception $e) {
$this->showError($e->getMessage());
}
foreach ($this->options[0] as $option) {
switch ($option[0]) {
case '--colors':
$this->arguments['colors'] = $option[1] ?: PHPUnit_TextUI_ResultPrinter::COLOR_AUTO;
break;
case '--bootstrap':
$this->arguments['bootstrap'] = $option[1];
break;
case '--columns':
if (is_numeric($option[1])) {
$this->arguments['columns'] = (int) $option[1];
} elseif ($option[1] == 'max') {
$this->arguments['columns'] = 'max';
}
break;
case 'c':
case '--configuration':
$this->arguments['configuration'] = $option[1];
break;
case '--coverage-clover':
$this->arguments['coverageClover'] = $option[1];
break;
case '--coverage-crap4j':
$this->arguments['coverageCrap4J'] = $option[1];
break;
case '--coverage-html':
$this->arguments['coverageHtml'] = $option[1];
break;
case '--coverage-php':
$this->arguments['coveragePHP'] = $option[1];
break;
case '--coverage-text':
if ($option[1] === null) {
$option[1] = 'php://stdout';
}
$this->arguments['coverageText'] = $option[1];
$this->arguments['coverageTextShowUncoveredFiles'] = false;
$this->arguments['coverageTextShowOnlySummary'] = false;
break;
case '--coverage-xml':
$this->arguments['coverageXml'] = $option[1];
//.........这里部分代码省略.........
示例9: handleArguments
/**
* Handles the command-line arguments.
*
* A child class of PHPUnit_TextUI_Command can hook into the argument
* parsing by adding the switch(es) to the $longOptions array and point to a
* callback method that handles the switch(es) in the child class like this
*
* <code>
* <?php
* class MyCommand extends PHPUnit_TextUI_Command
* {
* public function __construct()
* {
* // my-switch won't accept a value, it's an on/off
* $this->longOptions['my-switch'] = 'myHandler';
* // my-secondswitch will accept a value - note the equals sign
* $this->longOptions['my-secondswitch='] = 'myOtherHandler';
* }
*
* // --my-switch -> myHandler()
* protected function myHandler()
* {
* }
*
* // --my-secondswitch foo -> myOtherHandler('foo')
* protected function myOtherHandler ($value)
* {
* }
*
* // You will also need this - the static keyword in the
* // PHPUnit_TextUI_Command will mean that it'll be
* // PHPUnit_TextUI_Command that gets instantiated,
* // not MyCommand
* public static function main($exit = true)
* {
* $command = new static;
*
* return $command->run($_SERVER['argv'], $exit);
* }
*
* }
* </code>
*
* @param array $argv
*/
protected function handleArguments(array $argv)
{
if (defined('__PHPUNIT_PHAR__')) {
$this->longOptions['selfupdate'] = null;
$this->longOptions['self-update'] = null;
}
try {
$this->options = PHPUnit_Util_Getopt::getopt($argv, 'd:c:hv', array_keys($this->longOptions));
} catch (PHPUnit_Framework_Exception $e) {
$this->showError($e->getMessage());
}
foreach ($this->options[0] as $option) {
switch ($option[0]) {
case '--colors':
$this->arguments['colors'] = true;
break;
case '--bootstrap':
$this->arguments['bootstrap'] = $option[1];
break;
case '--columns':
if (is_numeric($option[1])) {
$this->arguments['columns'] = (int) $option[1];
} elseif ($option[1] == 'max') {
$this->arguments['columns'] = 'max';
}
break;
case 'c':
case '--configuration':
$this->arguments['configuration'] = $option[1];
break;
case '--coverage-clover':
$this->arguments['coverageClover'] = $option[1];
break;
case '--coverage-crap4j':
$this->arguments['coverageCrap4J'] = $option[1];
break;
case '--coverage-html':
$this->arguments['coverageHtml'] = $option[1];
break;
case '--coverage-php':
$this->arguments['coveragePHP'] = $option[1];
break;
case '--coverage-text':
if ($option[1] === null) {
$option[1] = 'php://stdout';
}
$this->arguments['coverageText'] = $option[1];
$this->arguments['coverageTextShowUncoveredFiles'] = false;
$this->arguments['coverageTextShowOnlySummary'] = false;
break;
case '--coverage-xml':
$this->arguments['coverageXml'] = $option[1];
break;
case 'd':
$ini = explode('=', $option[1]);
//.........这里部分代码省略.........
示例10: handleArguments
/**
*/
protected static function handleArguments()
{
$arguments = array('listGroups' => FALSE, 'syntaxCheck' => TRUE);
$longOptions = array('ansi', 'bootstrap=', 'configuration=', 'coverage-html=', 'coverage-clover=', 'coverage-source=', 'coverage-xml=', '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'] = '';
}
foreach ($options[0] as $option) {
switch ($option[0]) {
case '--ansi':
$arguments['ansi'] = TRUE;
break;
case '--bootstrap':
$arguments['bootstrap'] = $option[1];
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 '--help':
self::showHelp();
exit(PHPUnit_TextUI_TestRunner::SUCCESS_EXIT);
break;
case '--filter':
if (preg_match('/^[a-zA-Z0-9_]/', $option[1])) {
$arguments['filter'] = '/' . $option[1] . '/';
} else {
$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];
//.........这里部分代码省略.........
示例11: handleArguments
/**
* @access protected
* @static
*/
protected static function handleArguments()
{
$arguments = array('syntaxCheck' => TRUE);
$longOptions = array('configuration=', 'exclude-group=', 'filter=', 'group=', 'help', 'loader=', 'log-json=', 'log-tap=', 'log-xml=', 'repeat=', 'skeleton', 'stop-on-failure', 'tap', 'testdox', 'testdox-html=', 'testdox-text=', 'no-syntax-check', 'verbose', 'version', 'wait');
if (class_exists('Image_GraphViz', FALSE)) {
$longOptions[] = 'log-graphviz=';
}
if (extension_loaded('pdo')) {
$longOptions[] = 'test-db-dsn=';
$longOptions[] = 'test-db-log-rev=';
$longOptions[] = 'test-db-log-prefix=';
$longOptions[] = 'test-db-log-info=';
}
if (extension_loaded('xdebug')) {
$longOptions[] = 'coverage-html=';
$longOptions[] = 'coverage-xml=';
$longOptions[] = 'log-metrics=';
$longOptions[] = 'log-pmd=';
$longOptions[] = 'report=';
}
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'] = '';
}
foreach ($options[0] as $option) {
switch ($option[0]) {
case '--configuration':
$arguments['configuration'] = $option[1];
break;
case '--coverage-xml':
$arguments['coverageXML'] = $option[1];
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 '--help':
self::showHelp();
exit(PHPUnit_TextUI_TestRunner::SUCCESS_EXIT);
break;
case '--filter':
if (preg_match('/^[a-zA-Z0-9_]/', $option[1])) {
$arguments['filter'] = '/^' . $option[1] . '$/';
} else {
$arguments['filter'] = $option[1];
}
break;
case '--group':
$arguments['groups'] = explode(',', $option[1]);
break;
case '--exclude-group':
$arguments['excludeGroups'] = explode(',', $option[1]);
break;
case '--loader':
self::handleLoader($option[1]);
break;
case '--log-json':
$arguments['jsonLogfile'] = $option[1];
break;
case '--log-graphviz':
$arguments['graphvizLogfile'] = $option[1];
break;
case '--log-tap':
$arguments['tapLogfile'] = $option[1];
break;
case '--log-xml':
$arguments['xmlLogfile'] = $option[1];
break;
case '--log-pmd':
$arguments['pmdXML'] = $option[1];
break;
case '--log-metrics':
$arguments['metricsXML'] = $option[1];
break;
case '--repeat':
$arguments['repeat'] = (int) $option[1];
break;
case '--stop-on-failure':
$arguments['stopOnFailure'] = TRUE;
break;
case '--test-db-dsn':
//.........这里部分代码省略.........
示例12: processCommandlineOptions
/**
* Handles the commandline arguments passed.
*
* @return array the commandline arguments
*
* @author Felix Gilcher <felix.gilcher@bitextender.com>
* @since 1.0.0
*/
public static function processCommandlineOptions()
{
$longOptions = array('coverage-html=', 'coverage-clover=', 'coverage-source=', 'coverage-xml=', 'report=', 'environment=', 'help', 'log-graphviz=', 'log-json=', 'log-metrics=', 'log-pmd=', 'log-tap=', 'log-xml=', 'include-suite=', 'exclude-suite=');
try {
$options = PHPUnit_Util_Getopt::getopt($_SERVER['argv'], 'd:', $longOptions);
} catch (RuntimeException $e) {
PHPUnit_TextUI_TestRunner::showError($e->getMessage());
}
$arguments = array();
foreach ($options[0] as $option) {
switch ($option[0]) {
case '--coverage-clover':
case '--coverage-xml':
if (self::checkCodeCoverageDeps()) {
$arguments['coverageClover'] = $option[1];
}
break;
case '--coverage-source':
if (self::checkCodeCoverageDeps()) {
$arguments['coverageSource'] = $option[1];
}
break;
case '--coverage-html':
case '--report':
if (self::checkCodeCoverageDeps()) {
$arguments['reportDirectory'] = $option[1];
}
break;
case '--environment':
$arguments['environment'] = $option[1];
break;
case '--help':
self::showHelp();
exit(PHPUnit_TextUI_TestRunner::SUCCESS_EXIT);
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 {
throw new AgaviException('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 (self::checkCodeCoverageDeps()) {
$arguments['pmdXML'] = $option[1];
}
break;
case '--log-metrics':
if (self::checkCodeCoverageDeps()) {
$arguments['metricsXML'] = $option[1];
}
break;
case '--include-suite':
$arguments['include-suite'] = $option[1];
break;
case '--exclude-suite':
$arguments['exclude-suite'] = $option[1];
break;
}
}
return $arguments;
}
示例13: isDebug
public function isDebug()
{
list($opts, $non_opts) = \PHPUnit_Util_Getopt::getopt($_SERVER['argv'], 'd:c:hv');
$key = array_search('--debug', $non_opts);
return is_int($key);
}
示例14: handleArguments
/**
* Handles the command-line arguments.
*
* A child class of PHPUnit_TextUI_Command can hook into the argument
* parsing by adding the switch(es) to the $longOptions array and point to a
* callback method that handles the switch(es) in the child class like this
*
* <code>
* <?php
* class MyCommand extends PHPUnit_TextUI_Command
* {
* public function __construct()
* {
* $this->longOptions['--my-switch'] = 'myHandler';
* }
*
* // --my-switch foo -> myHandler('foo')
* protected function myHandler($value)
* {
* }
* }
* </code>
*
* @param array $argv
*/
protected function handleArguments(array $argv)
{
try {
$this->options = PHPUnit_Util_Getopt::getopt($argv, 'd:c:u:h:p:b:v::', array_keys($this->longOptions));
} catch (RuntimeException $e) {
PHPUnit_TextUI_TestRunner::showError($e->getMessage());
}
$skeletonClass = FALSE;
$skeletonTest = FALSE;
foreach ($this->options[0] as $option) {
switch ($option[0]) {
case '--colors':
$this->arguments['colors'] = TRUE;
break;
case '--bootstrap':
$this->arguments['bootstrap'] = $option[1];
break;
case 'c':
case '--configuration':
$this->arguments['configuration'] = $option[1];
break;
case '--coverage-clover':
case '--coverage-html':
case '--coverage-php':
case '--coverage-text':
if (!extension_loaded('tokenizer')) {
$this->showExtensionNotLoadedMessage('tokenizer', 'No code coverage will be generated.');
continue;
}
if (!extension_loaded('xdebug')) {
$this->showExtensionNotLoadedMessage('Xdebug', 'No code coverage will be generated.');
continue;
}
switch ($option[0]) {
case '--coverage-clover':
$this->arguments['coverageClover'] = $option[1];
break;
case '--coverage-html':
$this->arguments['reportDirectory'] = $option[1];
break;
case '--coverage-php':
$this->arguments['coveragePHP'] = $option[1];
break;
case '--coverage-text':
if ($option[1] === NULL) {
$option[1] = 'php://stdout';
}
$this->arguments['coverageText'] = $option[1];
$this->arguments['coverageTextShowUncoveredFiles'] = FALSE;
break;
}
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':
$this->arguments['debug'] = TRUE;
break;
case '--help':
$this->showHelp();
exit(PHPUnit_TextUI_TestRunner::SUCCESS_EXIT);
break;
case '--filter':
$this->arguments['filter'] = $option[1];
break;
case '--group':
$this->arguments['groups'] = explode(',', $option[1]);
break;
//.........这里部分代码省略.........
示例15: readOptions
/**
* Read PHPUnit options
*/
protected function readOptions()
{
try {
$reader = new Core_FileReader();
$options = \PHPUnit_Util_Getopt::getopt($_SERVER['argv'], 'd:c:hv', array_keys($reader->getLongOptions()));
} catch (\PHPUnit_Framework_Exception $e) {
\PHPUnit_TextUI_TestRunner::showError($e->getMessage());
}
foreach ($options[0] as $option) {
$this->options[$option[0]] = isset($option[1]) ? $option[1] : true;
}
}