本文整理汇总了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));
}
}
示例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;
}
示例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;
}
示例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;
}