當前位置: 首頁>>代碼示例>>PHP>>正文


PHP PHPUnit_Util_Getopt::parseLongOption方法代碼示例

本文整理匯總了PHP中PHPUnit_Util_Getopt::parseLongOption方法的典型用法代碼示例。如果您正苦於以下問題:PHP PHPUnit_Util_Getopt::parseLongOption方法的具體用法?PHP PHPUnit_Util_Getopt::parseLongOption怎麽用?PHP PHPUnit_Util_Getopt::parseLongOption使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在PHPUnit_Util_Getopt的用法示例。


在下文中一共展示了PHPUnit_Util_Getopt::parseLongOption方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: __construct

 /**
  * Parse the options to see if we are running the uninstall group.
  *
  * @since 0.1.0
  *
  * @param array $argv The commandline arguments.
  */
 public function __construct($argv)
 {
     array_shift($argv);
     $options = array();
     while (list($i, $arg) = each($argv)) {
         try {
             if (strlen($arg) > 1 && $arg[0] === '-' && $arg[1] === '-') {
                 PHPUnit_Util_Getopt::parseLongOption(substr($arg, 2), $this->longOptions, $options, $argv);
             }
         } catch (PHPUnit_Framework_Exception $e) {
             // Right now we don't really care what the arguments are like.
             continue;
         }
     }
     foreach ($options as $option) {
         switch ($option[0]) {
             case '--group':
                 $groups = explode(',', $option[1]);
                 $this->uninstall_group = in_array('uninstall', $groups);
                 break 2;
         }
     }
     if (!$this->uninstall_group) {
         echo 'Not running plugin install/uninstall tests... To execute these, use --group uninstall.' . PHP_EOL;
     }
 }
開發者ID:jdgrimes,項目名稱:wp-plugin-uninstall-tester,代碼行數:33,代碼來源:wp-plugin-uninstall-tester-phpunit-util-getopt.php

示例2: __construct

 function __construct($argv)
 {
     array_shift($argv);
     $options = array();
     while (list($i, $arg) = each($argv)) {
         try {
             if (strlen($arg) > 1 && $arg[0] === '-' && $arg[1] === '-') {
                 PHPUnit_Util_Getopt::parseLongOption(substr($arg, 2), $this->longOptions, $options, $argv);
             }
         } catch (PHPUnit_Framework_Exception $e) {
             // Enforcing recognized arguments or correctly formed arguments is
             // not really the concern here.
             continue;
         }
     }
     $ajax_message = true;
     foreach ($options 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;
     }
 }
開發者ID:Bostonncity,項目名稱:wp-browser,代碼行數:36,代碼來源:bootstrap.php

示例3: __construct

 function __construct($argv)
 {
     array_shift($argv);
     $options = array();
     while (list($i, $arg) = each($argv)) {
         try {
             if (strlen($arg) > 1 && $arg[0] === '-' && $arg[1] === '-') {
                 PHPUnit_Util_Getopt::parseLongOption(substr($arg, 2), $this->longOptions, $options, $argv);
             }
         } catch (PHPUnit_Framework_Exception $e) {
             // Enforcing recognized arguments or correctly formed arguments is
             // not really the concern here.
             continue;
         }
     }
     $skipped_groups = array('ajax' => true, 'ms-files' => true, 'external-http' => true);
     foreach ($options as $option) {
         switch ($option[0]) {
             case '--exclude-group':
                 foreach ($skipped_groups as $group_name => $skipped) {
                     $skipped_groups[$group_name] = 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);
                     }
                 }
                 foreach ($skipped_groups as $group_name => $skipped) {
                     if (in_array($group_name, $groups)) {
                         $skipped_groups[$group_name] = false;
                     }
                 }
                 continue 2;
         }
     }
     $skipped_groups = array_filter($skipped_groups);
     foreach ($skipped_groups as $group_name => $skipped) {
         echo sprintf('Not running %1$s tests. To execute these, use --group %1$s.', $group_name) . PHP_EOL;
     }
     if (!isset($skipped_groups['external-http'])) {
         echo PHP_EOL;
         echo 'External HTTP skipped tests can be caused by timeouts.' . PHP_EOL;
         echo 'If this changeset includes changes to HTTP, make sure there are no timeouts.' . PHP_EOL;
         echo PHP_EOL;
     }
 }
開發者ID:jaspermdegroot,項目名稱:develop.wordpress,代碼行數:49,代碼來源:bootstrap.php


注:本文中的PHPUnit_Util_Getopt::parseLongOption方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。