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


PHP PHPUnit_Util_Fileloader::getIncludePaths方法代码示例

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


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

示例1: load

 /**
  * @param  string  $suiteClassName
  * @param  string  $suiteClassFile
  * @param  boolean $syntaxCheck
  * @return ReflectionClass
  * @throws RuntimeException
  * @access public
  */
 public function load($suiteClassName, $suiteClassFile = '', $syntaxCheck = TRUE)
 {
     $suiteClassName = str_replace('.php', '', $suiteClassName);
     if (empty($suiteClassFile)) {
         $suiteClassFile = str_replace('_', '/', $suiteClassName) . '.php';
     }
     if (!class_exists($suiteClassName, FALSE)) {
         if (!file_exists($suiteClassFile)) {
             $includePaths = PHPUnit_Util_Fileloader::getIncludePaths();
             foreach ($includePaths as $includePath) {
                 $file = $includePath . DIRECTORY_SEPARATOR . $suiteClassFile;
                 if (file_exists($file)) {
                     $suiteClassFile = $file;
                     break;
                 }
             }
         }
         PHPUnit_Util_Fileloader::checkAndLoad($suiteClassFile, $syntaxCheck);
     }
     if (class_exists($suiteClassName, FALSE)) {
         return new ReflectionClass($suiteClassName);
     } else {
         throw new RuntimeException(sprintf('Class %s could not be found in %s.', $suiteClassName, $suiteClassFile));
     }
 }
开发者ID:humansky,项目名称:qframe,代码行数:33,代码来源:StandardTestSuiteLoader.php

示例2: collectTests

 /**
  * @return array
  * @access public
  */
 public function collectTests()
 {
     $includePathsIterator = new AppendIterator();
     $result = array();
     $includePaths = PHPUnit_Util_Fileloader::getIncludePaths();
     foreach ($includePaths as $includePath) {
         $includePathsIterator->append(new RecursiveIteratorIterator(new RecursiveDirectoryIterator($includePath)));
     }
     $filterIterator = new PHPUnit_Util_FilterIterator($includePathsIterator);
     if ($this->filterIterator !== NULL) {
         $class = new ReflectionClass($this->filterIterator);
         $filterIterator = $class->newInstance($filterIterator);
     }
     foreach ($filterIterator as $file) {
         $result[] = $file;
     }
     return $result;
 }
开发者ID:453111208,项目名称:bbc,代码行数:22,代码来源:IncludePathTestCollector.php

示例3: addTestFile

 /**
  * Wraps both <code>addTest()</code> and <code>addTestSuite</code>
  * as well as the separate import statements for the user's convenience.
  *
  * If the named file cannot be read or there are no new tests that can be
  * added, a <code>PHPUnit_Framework_Warning</code> will be created instead,
  * leaving the current test run untouched.
  *
  * @param  string  $filename
  * @param  boolean $syntaxCheck
  * @throws InvalidArgumentException
  * @access public
  * @since  Method available since Release 2.3.0
  * @author Stefano F. Rausch <stefano@rausch-e.net>
  */
 public function addTestFile($filename, $syntaxCheck = TRUE)
 {
     if (!is_string($filename)) {
         throw new InvalidArgumentException();
     }
     if (!file_exists($filename)) {
         $includePaths = PHPUnit_Util_Fileloader::getIncludePaths();
         foreach ($includePaths as $includePath) {
             $file = $includePath . DIRECTORY_SEPARATOR . $filename;
             if (file_exists($file)) {
                 $filename = $file;
                 break;
             }
         }
     }
     PHPUnit_Util_Class::collectStart();
     PHPUnit_Util_Fileloader::checkAndLoad($filename, $syntaxCheck);
     $newClasses = PHPUnit_Util_Class::collectEnd();
     $testsFound = FALSE;
     foreach ($newClasses as $className) {
         $class = new ReflectionClass($className);
         if (!$class->isAbstract()) {
             if ($class->hasMethod(PHPUnit_Runner_BaseTestRunner::SUITE_METHODNAME)) {
                 $method = $class->getMethod(PHPUnit_Runner_BaseTestRunner::SUITE_METHODNAME);
                 if ($method->isStatic()) {
                     $this->addTest($method->invoke(NULL));
                     $testsFound = TRUE;
                 }
             } else {
                 if ($class->implementsInterface('PHPUnit_Framework_Test')) {
                     $this->addTestSuite($class);
                     $testsFound = TRUE;
                 }
             }
         }
     }
     if (!$testsFound) {
         $this->addTest(new PHPUnit_Framework_Warning('No tests found in file "' . $filename . '".'));
     }
     $this->numTests = -1;
 }
开发者ID:dalinhuang,项目名称:shopexts,代码行数:56,代码来源:TestSuite.php

示例4: __construct

 /**
  * @param  array  $paths
  * @param  string $suffix
  * @access public
  */
 public function __construct(array $paths = array(), $suffix = 'Test.php')
 {
     if (!empty($paths)) {
         $this->paths = $paths;
     } else {
         $this->paths = PHPUnit_Util_Fileloader::getIncludePaths();
     }
     $this->suffix = $suffix;
 }
开发者ID:humansky,项目名称:qframe,代码行数:14,代码来源:IncludePathTestCollector.php


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