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


PHP PHPUnit_Util_GlobalState::phpunitFiles方法代码示例

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


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

示例1: getFilteredStacktrace

 /**
  * Filters stack frames from PHPUnit classes.
  *
  * @param  Exception $e
  * @param  boolean   $asString
  * @return string
  */
 public static function getFilteredStacktrace(Exception $e, $asString = TRUE)
 {
     if (!defined('PHPUNIT_TESTSUITE')) {
         $blacklist = PHPUnit_Util_GlobalState::phpunitFiles();
     } else {
         $blacklist = array();
     }
     if ($asString === TRUE) {
         $filteredStacktrace = '';
     } else {
         $filteredStacktrace = array();
     }
     if ($e instanceof PHPUnit_Framework_SyntheticError) {
         $eTrace = $e->getSyntheticTrace();
         $eFile = $e->getSyntheticFile();
         $eLine = $e->getSyntheticLine();
     } else {
         $eTrace = $e->getTrace();
         $eFile = $e->getFile();
         $eLine = $e->getLine();
     }
     if (!self::frameExists($eTrace, $eFile, $eLine)) {
         array_unshift($eTrace, array('file' => $eFile, 'line' => $eLine));
     }
     foreach ($eTrace as $frame) {
         if (isset($frame['file']) && is_file($frame['file']) && !isset($blacklist[$frame['file']])) {
             if ($asString === TRUE) {
                 $filteredStacktrace .= sprintf("%s:%s\n", $frame['file'], isset($frame['line']) ? $frame['line'] : '?');
             } else {
                 $filteredStacktrace[] = $frame;
             }
         }
     }
     return $filteredStacktrace;
 }
开发者ID:DaveNascimento,项目名称:civicrm-packages,代码行数:42,代码来源:Filter.php

示例2: getFilteredStacktrace

 /**
  * Filters stack frames from PHPUnit classes.
  *
  * @param  Exception $e
  * @param  boolean   $asString
  * @return string
  */
 public static function getFilteredStacktrace(Exception $e, $asString = TRUE)
 {
     $prefix = FALSE;
     $script = realpath($GLOBALS['_SERVER']['SCRIPT_NAME']);
     if (defined('__PHPUNIT_PHAR__')) {
         $prefix = 'phar://' . __PHPUNIT_PHAR__ . '/';
     }
     if (!defined('PHPUNIT_TESTSUITE')) {
         $blacklist = PHPUnit_Util_GlobalState::phpunitFiles();
     } else {
         $blacklist = array();
     }
     if ($asString === TRUE) {
         $filteredStacktrace = '';
     } else {
         $filteredStacktrace = array();
     }
     if ($e instanceof PHPUnit_Framework_SyntheticError) {
         $eTrace = $e->getSyntheticTrace();
         $eFile = $e->getSyntheticFile();
         $eLine = $e->getSyntheticLine();
     } else {
         if ($e->getPrevious()) {
             $eTrace = $e->getPrevious()->getTrace();
         } else {
             $eTrace = $e->getTrace();
         }
         $eFile = $e->getFile();
         $eLine = $e->getLine();
     }
     if (!self::frameExists($eTrace, $eFile, $eLine)) {
         array_unshift($eTrace, array('file' => $eFile, 'line' => $eLine));
     }
     foreach ($eTrace as $frame) {
         if (isset($frame['file']) && is_file($frame['file']) && !isset($blacklist[$frame['file']]) && ($prefix === FALSE || strpos($frame['file'], $prefix) !== 0) && $frame['file'] !== $script) {
             if ($asString === TRUE) {
                 $filteredStacktrace .= sprintf("%s:%s\n", $frame['file'], isset($frame['line']) ? $frame['line'] : '?');
             } else {
                 $filteredStacktrace[] = $frame;
             }
         }
     }
     return $filteredStacktrace;
 }
开发者ID:jeanCarloMachado,项目名称:challenges,代码行数:51,代码来源:Filter.php

示例3: phpunitFiles

 /**
  * @return array
  * @since  Method available since Release 3.6.0
  */
 public static function phpunitFiles()
 {
     if (self::$phpunitFiles === NULL) {
         self::$phpunitFiles = phpunit_autoload();
         if (function_exists('phpunit_mockobject_autoload')) {
             self::$phpunitFiles = array_merge(self::$phpunitFiles, phpunit_mockobject_autoload());
         }
         if (function_exists('file_iterator_autoload')) {
             self::$phpunitFiles = array_merge(self::$phpunitFiles, file_iterator_autoload());
         }
         if (function_exists('php_codecoverage_autoload')) {
             self::$phpunitFiles = array_merge(self::$phpunitFiles, php_codecoverage_autoload());
         }
         if (function_exists('php_timer_autoload')) {
             self::$phpunitFiles = array_merge(self::$phpunitFiles, php_timer_autoload());
         }
         if (function_exists('php_tokenstream_autoload')) {
             self::$phpunitFiles = array_merge(self::$phpunitFiles, php_tokenstream_autoload());
         }
         if (function_exists('text_template_autoload')) {
             self::$phpunitFiles = array_merge(self::$phpunitFiles, text_template_autoload());
         }
         if (function_exists('phpunit_dbunit_autoload')) {
             self::$phpunitFiles = array_merge(self::$phpunitFiles, phpunit_dbunit_autoload());
         }
         if (function_exists('phpunit_selenium_autoload')) {
             self::$phpunitFiles = array_merge(self::$phpunitFiles, phpunit_selenium_autoload());
         }
         if (function_exists('phpunit_story_autoload')) {
             self::$phpunitFiles = array_merge(self::$phpunitFiles, phpunit_story_autoload());
         }
         if (function_exists('php_invoker_autoload')) {
             self::$phpunitFiles = array_merge(self::$phpunitFiles, php_invoker_autoload());
         }
         foreach (self::$phpunitFiles as $key => $value) {
             self::$phpunitFiles[$key] = str_replace('/', DIRECTORY_SEPARATOR, $value);
         }
         self::$phpunitFiles = array_flip(self::$phpunitFiles);
     }
     return self::$phpunitFiles;
 }
开发者ID:DieguinhoHR,项目名称:kratos_store,代码行数:45,代码来源:GlobalState.php

示例4: phpunitFiles

 /**
  * @return array
  * @since  Method available since Release 3.6.0
  */
 public static function phpunitFiles()
 {
     if (self::$phpunitFiles === NULL) {
         self::$phpunitFiles = array_merge(phpunit_autoload(), phpunit_mockobject_autoload(), file_iterator_autoload(), php_codecoverage_autoload(), php_timer_autoload(), php_tokenstream_autoload(), text_template_autoload());
         if (function_exists('phpunit_dbunit_autoload')) {
             self::$phpunitFiles = array_merge(self::$phpunitFiles, phpunit_dbunit_autoload());
         }
         if (function_exists('phpunit_selenium_autoload')) {
             self::$phpunitFiles = array_merge(self::$phpunitFiles, phpunit_selenium_autoload());
         }
         if (function_exists('phpunit_story_autoload')) {
             self::$phpunitFiles = array_merge(self::$phpunitFiles, phpunit_story_autoload());
         }
         if (function_exists('php_invoker_autoload')) {
             self::$phpunitFiles = array_merge(self::$phpunitFiles, php_invoker_autoload());
         }
         self::$phpunitFiles = array_flip(self::$phpunitFiles);
     }
     return self::$phpunitFiles;
 }
开发者ID:nbalonso,项目名称:MunkiFace,代码行数:24,代码来源:GlobalState.php

示例5: phpunitFiles

 /**
  * @return array
  * @since  Method available since Release 3.6.0
  */
 public static function phpunitFiles()
 {
     if (self::$phpunitFiles === NULL) {
         self::$phpunitFiles = array();
         self::addDirectoryContainingClassToPHPUnitFilesList('File_Iterator');
         self::addDirectoryContainingClassToPHPUnitFilesList('PHP_CodeCoverage');
         self::addDirectoryContainingClassToPHPUnitFilesList('PHP_Invoker');
         self::addDirectoryContainingClassToPHPUnitFilesList('PHP_Timer');
         self::addDirectoryContainingClassToPHPUnitFilesList('PHP_Token');
         self::addDirectoryContainingClassToPHPUnitFilesList('PHPUnit_Framework_TestCase', 2);
         self::addDirectoryContainingClassToPHPUnitFilesList('PHPUnit_Extensions_Database_TestCase', 2);
         self::addDirectoryContainingClassToPHPUnitFilesList('PHPUnit_Framework_MockObject_Generator', 2);
         self::addDirectoryContainingClassToPHPUnitFilesList('PHPUnit_Extensions_SeleniumTestCase', 2);
         self::addDirectoryContainingClassToPHPUnitFilesList('PHPUnit_Extensions_Story_TestCase', 2);
         self::addDirectoryContainingClassToPHPUnitFilesList('Text_Template');
     }
     return self::$phpunitFiles;
 }
开发者ID:SebFav,项目名称:ApplicationInternet2,代码行数:22,代码来源:GlobalState.php

示例6: dirname

 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */
require dirname(dirname(__FILE__)) . '/PHPUnit/Autoload.php';
$stub = <<<ENDSTUB
#!/usr/bin/env php
<?php
Phar::mapPhar('phpunit.phar');
require 'phar://phpunit.phar/PHPUnit/Autoload.php';
PHPUnit_TextUI_Command::main();
__HALT_COMPILER();
ENDSTUB;
$phar = new Phar('phpunit.phar', 0, 'phpunit.phar');
$phar->startBuffering();
$files = array_keys(PHPUnit_Util_GlobalState::phpunitFiles());
$offset = substr_count(dirname(__FILE__), '/');
foreach ($files as $file) {
    $phar->addFile($file, join('/', array_slice(explode('/', $file), $offset)));
}
$phar->setStub($stub);
$phar->stopBuffering();
开发者ID:nizarbey,项目名称:phpunit-all-in-one,代码行数:31,代码来源:create-phar.php

示例7: getDependendClasses

 /**
  * Get the dependend classes of this test.
  *
  * @return       string[] An array containing class names as keys and path to the 
  *                        file's defining class as value.
  *
  * @author       Dominik del Bondio <dominik.del.bondio@bitextender.com>
  * @since        1.1.0
  */
 private function getDependendClasses()
 {
     // We need to collect the dependend classes in case there is a test which
     // has set @agaviBootstrap to off. That results in the Agavi autoloader not
     // being started and if the test class depends on any files from Agavi (like
     // AgaviPhpUnitTestCase) it would not be loaded when the test is instantiated
     $classesInTest = array();
     $reflectionClass = new ReflectionClass(get_class($this));
     $testFile = $reflectionClass->getFileName();
     $getDeclaredFuncs = array('get_declared_classes', 'get_declared_interfaces');
     if (version_compare(PHP_VERSION, '5.4', '>=')) {
         $getDeclaredFuncs[] = 'get_declared_traits';
     }
     foreach ($getDeclaredFuncs as $getDeclaredFunc) {
         foreach ($getDeclaredFunc() as $name) {
             $reflectionClass = new ReflectionClass($name);
             if ($testFile === $reflectionClass->getFileName()) {
                 $classesInTest[] = $name;
             }
         }
     }
     // FIXME: added by phpunit 4.x
     if (class_exists('PHPUnit_Util_Blacklist')) {
         $blacklist = new PHPUnit_Util_Blacklist();
         $isBlacklisted = function ($file) use($testFile, $blacklist) {
             return $file === $testFile || $blacklist->isBlacklisted($file);
         };
     } elseif (is_callable(array('PHPUnit_Util_GlobalState', 'phpunitFiles'))) {
         $blacklist = PHPUnit_Util_GlobalState::phpunitFiles();
         $isBlacklisted = function ($file) use($testFile, $blacklist) {
             return $file === $testFile || isset($blacklist[$file]);
         };
     } else {
         $isBlacklisted = function ($file) use($testFile) {
             return $file === $testFile;
         };
     }
     $classesToFile = array('AgaviTesting' => realpath(__DIR__ . '/AgaviTesting.class.php'));
     foreach ($classesInTest as $className) {
         $classesToFile = array_merge($classesToFile, $this->getClassDependendFiles(new ReflectionClass($className), $isBlacklisted));
     }
     return $classesToFile;
 }
开发者ID:horros,项目名称:agavi,代码行数:52,代码来源:AgaviPhpUnitTestCase.class.php


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