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


PHP PHPUnit_TextUI_Command::handleLoader方法代码示例

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


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

示例1: main

 public static function main()
 {
     global $isLocal;
     // check number of arguments
     $isLocal = !isset($_SERVER['HTTP_USER_AGENT']);
     $arguments = array('listGroups' => FALSE, 'loader' => NULL, 'useDefaultConfiguration' => TRUE);
     $loader = NULL;
     $startPos = 1;
     $canCountTest = true;
     global $config_file;
     if ($isLocal && $_SERVER['argv'][1] == "-config" || !$isLocal && strcmp($config_file, "") != 0 && strcmp($config_file, "/*config_xml*/") != 0) {
         // check if configuration specified
         $canCountTest = false;
         $path = $isLocal ? $_SERVER['argv'][2] : $config_file;
         //$_GET["config_xml"];
         $arguments['configuration'] = $path;
         $startPos = 3;
         $configuration = PHPUnit_Util_Configuration::getInstance($path);
         $phpunit = $configuration->getPHPUnitConfiguration();
         if (isset($phpunit['testSuiteLoaderClass'])) {
             if (isset($phpunit['testSuiteLoaderFile'])) {
                 $file = $phpunit['testSuiteLoaderFile'];
             } else {
                 $file = '';
             }
             $command = new PHPUnit_TextUI_Command();
             $loader = $command->handleLoader($phpunit['testSuiteLoaderClass'], $file);
             $arguments['loader'] = $loader;
         }
         $configuration->handlePHPConfiguration();
         $phpunitConfiguration = $configuration->getPHPUnitConfiguration();
         if (isset($phpunitConfiguration['bootstrap'])) {
             PHPUnit_Util_Fileloader::load($phpunitConfiguration['bootstrap']);
         }
         $browsers = $configuration->getSeleniumBrowserConfiguration();
         if (!empty($browsers)) {
             require_once 'PHPUnit/Extensions/SeleniumTestCase.php';
             PHPUnit_Extensions_SeleniumTestCase::$browsers = $browsers;
         }
     }
     if ($isLocal && $_SERVER['argv'][$startPos] == "-group" || !$isLocal && isset($_GET["groups"])) {
         $arguments['groups'] = explode(',', $isLocal ? $_SERVER['argv'][$startPos + 1] : $_GET["groups"]);
         $startPos += 2;
     }
     if ($isLocal && $_SERVER['argv'][$startPos] == "-exclude-group" || !$isLocal && isset($_GET["exclude_groups"])) {
         $arguments['excludeGroups'] = explode(',', $isLocal ? $_SERVER['argv'][$startPos + 1] : $_GET["exclude_groups"]);
         $startPos += 2;
     }
     $check = $isLocal ? $_SERVER['argv'][$startPos] : $_GET["mode"];
     if ($check == "c") {
         $suiteClassName = $isLocal ? $_SERVER['argv'][$startPos + 1] : $_GET["class"];
         $suiteClassFile = $isLocal ? $_SERVER['argv'][$startPos + 2] : $_GET["file"];
         try {
             // $testClass = ();
             if ($loader == NULL) {
                 $loader = new PHPUnit_Runner_StandardTestSuiteLoader();
             }
             $testClass = $loader->load($suiteClassName, $suiteClassFile, FALSE);
         } catch (Exception $e) {
             myExceptionHandler($e);
             return;
         }
         try {
             // if class is a suite
             $suiteMethod = $testClass->getMethod('suite');
             if ($suiteMethod->isAbstract() || !$suiteMethod->isPublic() || !$suiteMethod->isStatic()) {
                 return;
             }
             try {
                 // ?? suite does not have testName argument
                 $test = $suiteMethod->invoke(NULL, $testClass->getName());
                 $test->setName($suiteClassName);
                 if ($canCountTest) {
                     print traceCommand("testCount", "count", (string) sizeof($test));
                 }
                 self::runTest($test, $suiteClassFile, $arguments);
             } catch (ReflectionException $e) {
                 myExceptionHandler($e);
                 return;
             }
         } catch (ReflectionException $e) {
             $test = new PHPUnit_Framework_TestSuite($testClass);
             if ($canCountTest) {
                 print traceCommand("testCount", "count", (string) sizeof($test));
             }
             self::runTest($test, $suiteClassFile, $arguments);
         }
     } else {
         if ($check == "d") {
             // if run directory
             // in remote case we put this script in the test directory
             $suiteDirName = $isLocal ? $_SERVER['argv'][$startPos + 1] : dirname(__FILE__);
             if (is_dir($suiteDirName) && !is_file($suiteDirName . '.php')) {
                 $testCollector = new PHPUnit_Runner_IncludePathTestCollector(array($suiteDirName));
                 // $test = new PHPUnit_Framework_TestSuite($suiteDirName);
                 $filenames = $testCollector->collectTests();
                 $number = 0;
                 $alltests = array();
                 foreach ($filenames as $filename) {
                     $tests = self::collectTestsFromFile($filename);
//.........这里部分代码省略.........
开发者ID:Aktubius,项目名称:Lesons_SAG,代码行数:101,代码来源:_intellij_phpunit_launcher.php


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