本文整理汇总了PHP中PHPUnit_Util_Filesystem::fileExistsInIncludePath方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPUnit_Util_Filesystem::fileExistsInIncludePath方法的具体用法?PHP PHPUnit_Util_Filesystem::fileExistsInIncludePath怎么用?PHP PHPUnit_Util_Filesystem::fileExistsInIncludePath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPUnit_Util_Filesystem
的用法示例。
在下文中一共展示了PHPUnit_Util_Filesystem::fileExistsInIncludePath方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* @param string $type The type of concrete Log subclass to use.
* Currently, valid values are 'console',
* 'syslog', 'sql', 'file', and 'mcal'.
* @param string $name The name of the actually log file, table, or
* other specific store to use. Defaults to an
* empty string, with which the subclass will
* attempt to do something intelligent.
* @param string $ident The identity reported to the log system.
* @param array $conf A hash containing any additional configuration
* information that a subclass might need.
* @param int $maxLevel Maximum priority level at which to log.
*/
public function __construct($type, $name = '', $ident = '', $conf = array(), $maxLevel = PEAR_LOG_DEBUG)
{
if (PHPUnit_Util_Filesystem::fileExistsInIncludePath('Log.php')) {
require_once 'Log.php';
} else {
throw new RuntimeException('Log is not available.');
}
$this->log = Log::factory($type, $name, $ident, $conf, $maxLevel);
}
示例2: checkAndLoad
/**
* Checks if a PHP sourcefile is readable.
* The sourcefile is loaded through the load() method.
*
* @param string $filename
* @throws RuntimeException
*/
public static function checkAndLoad($filename)
{
$includePathFilename = PHPUnit_Util_Filesystem::fileExistsInIncludePath($filename);
if (!$includePathFilename || !is_readable($includePathFilename)) {
throw new RuntimeException(sprintf('Cannot open file "%s".' . "\n", $filename));
}
self::load($includePathFilename);
return $includePathFilename;
}
示例3: phpunit_autoload
function phpunit_autoload($class)
{
if (strpos($class, 'PHPUnit_') === 0) {
$file = str_replace('_', '/', $class) . '.php';
$file = PHPUnit_Util_Filesystem::fileExistsInIncludePath($file);
if ($file) {
require_once $file;
}
}
}
示例4: phpunit_autoload
function phpunit_autoload($class)
{
if (strpos($class, 'PHPUnit_') === 0) {
$file = str_replace('_', '/', $class) . '.php';
$file = PHPUnit_Util_Filesystem::fileExistsInIncludePath($file);
if ($file) {
require_once $file;
PHP_CodeCoverage_Filter::getInstance()->addFileToBlacklist($file, 'PHPUNIT');
}
}
}
示例5: __construct
/**
* @param string $type The type of concrete Log subclass to use.
* Currently, valid values are 'console',
* 'syslog', 'sql', 'file', and 'mcal'.
* @param string $name The name of the actually log file, table, or
* other specific store to use. Defaults to an
* empty string, with which the subclass will
* attempt to do something intelligent.
* @param string $ident The identity reported to the log system.
* @param array $conf A hash containing any additional configuration
* information that a subclass might need.
* @param int $maxLevel Maximum priority level at which to log.
*/
public function __construct($type, $name = '', $ident = '', $conf = array(), $maxLevel = PEAR_LOG_DEBUG)
{
if (PHPUnit_Util_Filesystem::fileExistsInIncludePath('Log.php')) {
PHPUnit_Util_Filesystem::collectStart();
require_once 'Log.php';
$this->log = Log::factory($type, $name, $ident, $conf, $maxLevel);
foreach (PHPUnit_Util_Filesystem::collectEnd() as $blacklistedFile) {
PHPUnit_Util_Filter::addFileToFilter($blacklistedFile, 'PHPUNIT');
}
} else {
throw new RuntimeException('Log is not available.');
}
}
示例6: load
/**
* Loads a PHP sourcefile.
*
* @param string $filename
* @return mixed
* @since Method available since Release 3.0.0
*/
public static function load($filename)
{
$filename = PHPUnit_Util_Filesystem::fileExistsInIncludePath($filename);
$oldVariableNames = array_keys(get_defined_vars());
include_once $filename;
$newVariables = get_defined_vars();
$newVariableNames = array_diff(array_keys($newVariables), $oldVariableNames);
foreach ($newVariableNames as $variableName) {
if ($variableName != 'oldVariableNames') {
$GLOBALS[$variableName] = $newVariables[$variableName];
}
}
return $filename;
}
示例7: load
/**
* Loads a PHP sourcefile.
*
* @param string $filename
* @return mixed
* @since Method available since Release 3.0.0
*/
public static function load($filename)
{
$_filename = PHPUnit_Util_Filesystem::fileExistsInIncludePath($filename);
if (!$_filename) {
throw new RuntimeException(sprintf('Cannot open file "%s".' . "\n", $filename));
}
$filename = $_filename;
$oldVariableNames = array_keys(get_defined_vars());
unset($_filename);
include_once $filename;
$newVariables = get_defined_vars();
$newVariableNames = array_diff(array_keys($newVariables), $oldVariableNames);
foreach ($newVariableNames as $variableName) {
if ($variableName != 'oldVariableNames') {
$GLOBALS[$variableName] = $newVariables[$variableName];
}
}
return $filename;
}
示例8: updateTicket
protected function updateTicket($ticketId, $newStatus, $message, $resolution)
{
if (PHPUnit_Util_Filesystem::fileExistsInIncludePath('XML/RPC2/Client.php')) {
PHPUnit_Util_Filesystem::collectStart();
require_once 'XML/RPC2/Client.php';
$ticket = XML_RPC2_Client::create($this->scheme . '://' . $this->username . ':' . $this->password . '@' . $this->hostpath, array('prefix' => 'ticket.'));
try {
$ticketInfo = $ticket->get($ticketId);
} catch (XML_RPC2_FaultException $e) {
throw new PHPUnit_Framework_Exception(sprintf("Trac fetch failure: %d: %s\n", $e->getFaultCode(), $e->getFaultString()));
}
try {
printf("Updating Trac ticket #%d, status: %s\n", $ticketId, $newStatus);
$ticket->update($ticketId, $message, array('status' => $newStatus, 'resolution' => $resolution));
} catch (XML_RPC2_FaultException $e) {
throw new PHPUnit_Framework_Exception(sprintf("Trac update failure: %d: %s\n", $e->getFaultCode(), $e->getFaultString()));
}
PHPUnit_Util_Filesystem::collectEndAndAddToBlacklist();
} else {
throw new PHPUnit_Framework_Exception('XML_RPC2 is not available.');
}
}
示例9:
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* @category Testing
* @package PHPUnit
* @author Sebastian Bergmann <sb@sebastian-bergmann.de>
* @copyright 2002-2010 Sebastian Bergmann <sb@sebastian-bergmann.de>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://www.phpunit.de/
* @since File available since Release 3.0.0
*/
require_once 'PHPUnit/Framework.php';
require_once 'PHPUnit/Util/Filter.php';
require_once 'PHPUnit/Util/Printer.php';
require_once 'PHPUnit/Util/Test.php';
if (PHPUnit_Util_Filesystem::fileExistsInIncludePath('SymfonyComponents/YAML/sfYamlDumper.php')) {
require_once 'SymfonyComponents/YAML/sfYamlDumper.php';
}
PHPUnit_Util_Filter::addFileToFilter(__FILE__, 'PHPUNIT');
/**
* A TestListener that generates a logfile of the
* test execution using the Test Anything Protocol (TAP).
*
* @category Testing
* @package PHPUnit
* @author Sebastian Bergmann <sb@sebastian-bergmann.de>
* @copyright 2002-2010 Sebastian Bergmann <sb@sebastian-bergmann.de>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version Release: 3.4.15
* @link http://www.phpunit.de/
* @since Class available since Release 3.0.0
示例10: matchPaths
/**
* @param array $checksums
* @param array $data
* @return array
* @since Method available since Release 1.1.0
*/
protected function matchPaths(array $checksums, array $data)
{
$coverageWithLocalPaths = array();
foreach ($data as $originalRemotePath => $coverage) {
$remotePath = $originalRemotePath;
if (strpos($path, '/') !== FALSE) {
$separator = '/';
} else {
$separator = '\\';
}
while (!($localPath = PHPUnit_Util_Filesystem::fileExistsInIncludePath($remotePath)) && strpos($remotePath, $separator) !== FALSE) {
$remotePath = substr($remotePath, strpos($remotePath, $separator) + 1);
}
if ($localPath && sha1_file($localPath) == $checksums[$originalRemotePath]) {
$coverageWithLocalPaths[$localPath] = $coverage;
}
}
return $coverageWithLocalPaths;
}
示例11: toAbsolutePath
/**
* @param string $path
* @param boolean $useIncludePath
* @return string
* @since Method available since Release 3.5.0
*/
protected function toAbsolutePath($path, $useIncludePath = FALSE)
{
// Check whether the path is already absolute.
if ($path[0] === '/' || $path[0] === '\\' || strlen($path) > 3 && ctype_alpha($path[0]) && $path[1] === ':' && ($path[2] === '\\' || $path[2] === '/')) {
return $path;
}
// Check whether a stream is used.
if (strpos($path, '://') !== FALSE) {
return $path;
}
$file = dirname($this->filename) . DIRECTORY_SEPARATOR . $path;
if ($useIncludePath && !file_exists($file)) {
$includePathFile = PHPUnit_Util_Filesystem::fileExistsInIncludePath($path);
if ($includePathFile) {
$file = $includePathFile;
}
}
return $file;
}
示例12: __construct
/**
* Constructor.
*
* @param mixed $out
*/
public function __construct($out = NULL)
{
if (PHPUnit_Util_Filesystem::fileExistsInIncludePath('Image/GraphViz.php')) {
require_once 'Image/GraphViz.php';
} else {
throw new RuntimeException('Image_GraphViz is not available.');
}
$this->graph = new Image_GraphViz(TRUE, array('overlap' => 'scale', 'splines' => 'true', 'sep' => '.1', 'fontsize' => '8'));
parent::__construct($out);
}
示例13: matchLocalAndRemotePaths
/**
* @param array $coverage
* @return array
* @author Mattis Stordalen Flister <mattis@xait.no>
* @since Method available since Release 3.2.9
*/
protected function matchLocalAndRemotePaths(array $coverage)
{
$coverageWithLocalPaths = array();
foreach ($coverage as $originalRemotePath => $data) {
$remotePath = $originalRemotePath;
$separator = $this->findDirectorySeparator($remotePath);
while (!($localpath = PHPUnit_Util_Filesystem::fileExistsInIncludePath($remotePath)) && strpos($remotePath, $separator) !== FALSE) {
$remotePath = substr($remotePath, strpos($remotePath, $separator) + 1);
}
if ($localpath && md5_file($localpath) == $data['md5']) {
$coverageWithLocalPaths[$localpath] = $data['coverage'];
}
}
return $coverageWithLocalPaths;
}
示例14: __construct
/**
* Constructor.
*
* @param mixed $out
*/
public function __construct($out = NULL)
{
if (PHPUnit_Util_Filesystem::fileExistsInIncludePath('Image/GraphViz.php')) {
PHPUnit_Util_Filesystem::collectStart();
require_once 'Image/GraphViz.php';
$this->graph = new Image_GraphViz(TRUE, array('overlap' => 'scale', 'splines' => 'true', 'sep' => '.1', 'fontsize' => '8'));
parent::__construct($out);
foreach (PHPUnit_Util_Filesystem::collectEnd() as $blacklistedFile) {
PHPUnit_Util_Filter::addFileToFilter($blacklistedFile, 'PHPUNIT');
}
} else {
throw new RuntimeException('Image_GraphViz is not available.');
}
}
示例15: handleArguments
//.........这里部分代码省略.........
ini_set($ini[0], $ini[1]);
} else {
ini_set($ini[0], TRUE);
}
}
break;
case '--help':
self::showHelp();
exit(PHPUnit_TextUI_TestRunner::SUCCESS_EXIT);
break;
case '--filter':
if (preg_match('/^[a-zA-Z0-9_]/', $option[1])) {
$arguments['filter'] = '/' . $option[1] . '/';
} else {
$arguments['filter'] = $option[1];
}
break;
case '--group':
$arguments['groups'] = explode(',', $option[1]);
break;
case '--exclude-group':
$arguments['excludeGroups'] = explode(',', $option[1]);
break;
case '--list-groups':
$arguments['listGroups'] = TRUE;
break;
case '--loader':
self::handleLoader($option[1]);
break;
case '--log-json':
$arguments['jsonLogfile'] = $option[1];
break;
case '--log-graphviz':
if (PHPUnit_Util_Filesystem::fileExistsInIncludePath('Image/GraphViz.php')) {
$arguments['graphvizLogfile'] = $option[1];
} else {
self::showMissingDependency('The Image_GraphViz package is not installed.');
}
break;
case '--log-tap':
$arguments['tapLogfile'] = $option[1];
break;
case '--log-xml':
$arguments['xmlLogfile'] = $option[1];
break;
case '--log-pmd':
if (extension_loaded('tokenizer') && extension_loaded('xdebug')) {
$arguments['pmdXML'] = $option[1];
} else {
if (!extension_loaded('tokenizer')) {
self::showMissingDependency('The tokenizer extension is not loaded.');
} else {
self::showMissingDependency('The Xdebug extension is not loaded.');
}
}
break;
case '--log-metrics':
if (extension_loaded('tokenizer') && extension_loaded('xdebug')) {
$arguments['metricsXML'] = $option[1];
} else {
if (!extension_loaded('tokenizer')) {
self::showMissingDependency('The tokenizer extension is not loaded.');
} else {
self::showMissingDependency('The Xdebug extension is not loaded.');
}
}