本文整理汇总了PHP中PHP_CodeCoverage_Filter::isFile方法的典型用法代码示例。如果您正苦于以下问题:PHP PHP_CodeCoverage_Filter::isFile方法的具体用法?PHP PHP_CodeCoverage_Filter::isFile怎么用?PHP PHP_CodeCoverage_Filter::isFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHP_CodeCoverage_Filter
的用法示例。
在下文中一共展示了PHP_CodeCoverage_Filter::isFile方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: applySelfFilter
/**
* Filters sourcecode files from PHP_CodeCoverage, PHP_TokenStream,
* Text_Template, and File_Iterator.
*
* @param array $data
*/
protected function applySelfFilter(&$data)
{
foreach (array_keys($data) as $filename) {
if (!$this->filter->isFile($filename)) {
unset($data[$filename]);
continue;
}
if (!$this->isCodeCoverageTestSuite && strpos($filename, dirname(__FILE__)) === 0) {
unset($data[$filename]);
continue;
}
if (!$this->isFileIteratorTestSuite && (substr($filename, -17) == 'File/Iterator.php' || substr($filename, -25) == 'File/Iterator/Factory.php')) {
unset($data[$filename]);
continue;
}
if (!$this->isTimerTestSuite && substr($filename, -13) == 'PHP/Timer.php') {
unset($data[$filename]);
continue;
}
if (!$this->isTokenStreamTestSuite && (substr($filename, -13) == 'PHP/Token.php' || substr($filename, -20) == 'PHP/Token/Stream.php' || substr($filename, -35) == 'PHP/Token/Stream/CachingFactory.php')) {
unset($data[$filename]);
continue;
}
if (substr($filename, -17) == 'Text/Template.php') {
unset($data[$filename]);
}
}
}
示例2: applySelfFilter
/**
* Filters sourcecode files from PHP_CodeCoverage, PHP_TokenStream,
* Text_Template, and File_Iterator.
*
* @param array $data
*/
protected function applySelfFilter(&$data)
{
foreach (array_keys($data) as $filename) {
if (!$this->filter->isFile($filename)) {
unset($data[$filename]);
continue;
}
if (!defined('PHP_CODECOVERAGE_TESTSUITE') && strpos($filename, dirname(__FILE__)) === 0) {
unset($data[$filename]);
continue;
}
if (!defined('FILE_ITERATOR_TESTSUITE') && (substr($filename, -17) == 'File/Iterator.php' || substr($filename, -25) == 'File/Iterator/Factory.php')) {
unset($data[$filename]);
continue;
}
if (!defined('PHP_TIMER_TESTSUITE') && substr($filename, -13) == 'PHP/Timer.php') {
unset($data[$filename]);
continue;
}
if (!defined('PHP_TOKENSTREAM_TESTSUITE') && (substr($filename, -13) == 'PHP/Token.php' || substr($filename, -20) == 'PHP/Token/Stream.php' || substr($filename, -35) == 'PHP/Token/Stream/CachingFactory.php')) {
unset($data[$filename]);
continue;
}
if (substr($filename, -17) == 'Text/Template.php') {
unset($data[$filename]);
}
}
}
示例3: initializeFilesThatAreSeenTheFirstTime
/**
* @param array $data
* @since Method available since Release 1.1.0
*/
private function initializeFilesThatAreSeenTheFirstTime(array $data)
{
foreach ($data as $file => $lines) {
if ($this->filter->isFile($file) && !isset($this->data[$file])) {
$this->data[$file] = array();
foreach ($lines as $k => $v) {
$this->data[$file][$k] = $v == -2 ? null : array();
}
}
}
}
示例4: getcwd
require_once 'File/Iterator/Autoload.php';
require_once 'PHP/CodeCoverage/Autoload.php';
// Set this to the directory that contains the code coverage files.
// It defaults to getcwd(). If you have configured a different directory
// in prepend.php, you need to configure the same directory here.
$GLOBALS['PHPUNIT_COVERAGE_DATA_DIRECTORY'] = getcwd();
if (isset($_GET['PHPUNIT_SELENIUM_TEST_ID'])) {
$facade = new File_Iterator_Facade();
$files = $facade->getFilesAsArray($GLOBALS['PHPUNIT_COVERAGE_DATA_DIRECTORY'], $_GET['PHPUNIT_SELENIUM_TEST_ID']);
$coverage = array();
foreach ($files as $file) {
$data = unserialize(file_get_contents($file));
unlink($file);
unset($file);
$filter = new PHP_CodeCoverage_Filter();
foreach ($data as $file => $lines) {
if ($filter->isFile($file)) {
if (!isset($coverage[$file])) {
$coverage[$file] = array('md5' => md5_file($file), 'coverage' => $lines);
} else {
foreach ($lines as $line => $flag) {
if (!isset($coverage[$file]['coverage'][$line]) || $flag > $coverage[$file]['coverage'][$line]) {
$coverage[$file]['coverage'][$line] = $flag;
}
}
}
}
}
}
print serialize($coverage);
}
示例5: getcwd
*/
require_once 'File/Iterator/Factory.php';
require_once 'PHP/CodeCoverage/Filter.php';
// Set this to the directory that contains the code coverage files.
// It defaults to getcwd(). If you have configured a different directory
// in prepend.php, you need to configure the same directory here.
$GLOBALS['PHPUNIT_COVERAGE_DATA_DIRECTORY'] = getcwd();
if (isset($_GET['PHPUNIT_SELENIUM_TEST_ID'])) {
$files = File_Iterator_Factory::getFileIterator($GLOBALS['PHPUNIT_COVERAGE_DATA_DIRECTORY'], $_GET['PHPUNIT_SELENIUM_TEST_ID']);
$coverage = array();
foreach ($files as $file) {
$filename = $file->getPathName();
$data = unserialize(file_get_contents($filename));
@unlink($filename);
unset($filename);
foreach ($data as $filename => $lines) {
if (PHP_CodeCoverage_Filter::isFile($filename)) {
if (!isset($coverage[$filename])) {
$coverage[$filename] = array('md5' => md5_file($filename), 'coverage' => $lines);
} else {
foreach ($lines as $line => $flag) {
if (!isset($coverage[$filename]['coverage'][$line]) || $flag > $coverage[$filename]['coverage'][$line]) {
$coverage[$filename]['coverage'][$line] = $flag;
}
}
}
}
}
}
print serialize($coverage);
}
示例6: aggregateCoverageInformation
/**
* Aggregates previously collected coverage information.
*
* @return string
*/
public function aggregateCoverageInformation()
{
if (!isset($_GET[self::TEST_ID_VARIABLE])) {
return '';
}
$coverage = array();
$filter = new \PHP_CodeCoverage_Filter();
foreach ($this->getDataDirectoryFiles() as $data_directory_file) {
$raw_coverage_data = unserialize(file_get_contents($data_directory_file));
foreach ($raw_coverage_data as $file => $lines) {
if (!$filter->isFile($file)) {
continue;
}
if (!isset($coverage[$file])) {
$coverage[$file] = array('md5' => md5_file($file), 'coverage' => $lines);
} else {
foreach ($lines as $line => $flag) {
if (!isset($coverage[$file]['coverage'][$line]) || $flag > $coverage[$file]['coverage'][$line]) {
$coverage[$file]['coverage'][$line] = $flag;
}
}
}
}
}
return serialize($coverage);
}
示例7: array
$factory = new File_Iterator_Factory();
$files = $factory->getFileIterator($GLOBALS['PHPUNIT_COVERAGE_DATA_DIRECTORY'], $_GET['PHPUNIT_SELENIUM_TEST_ID']);
$filter = new PHP_CodeCoverage_Filter();
$used = array();
$coverage = array();
foreach ($files as $file) {
$filename = $file->getPathName();
if (isset($used[$filename])) {
//strange bug
continue;
}
$data = unserialize(file_get_contents($filename));
@unlink($filename);
$used[$filename] = true;
unset($filename);
foreach ($data as $filename => $lines) {
if ($filter->isFile($filename)) {
if (!isset($coverage[$filename])) {
$coverage[$filename] = array('md5' => md5_file($filename), 'coverage' => $lines);
} else {
foreach ($lines as $line => $flag) {
if (!isset($coverage[$filename]['coverage'][$line]) || $flag > $coverage[$filename]['coverage'][$line]) {
$coverage[$filename]['coverage'][$line] = $flag;
}
}
}
}
}
}
print serialize($coverage);
}