當前位置: 首頁>>代碼示例>>PHP>>正文


PHP PHP_CodeCoverage_Filter::getWhitelist方法代碼示例

本文整理匯總了PHP中PHP_CodeCoverage_Filter::getWhitelist方法的典型用法代碼示例。如果您正苦於以下問題:PHP PHP_CodeCoverage_Filter::getWhitelist方法的具體用法?PHP PHP_CodeCoverage_Filter::getWhitelist怎麽用?PHP PHP_CodeCoverage_Filter::getWhitelist使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在PHP_CodeCoverage_Filter的用法示例。


在下文中一共展示了PHP_CodeCoverage_Filter::getWhitelist方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: addUncoveredFilesFromWhitelist

    /**
     * Processes whitelisted files that are not covered.
     */
    private function addUncoveredFilesFromWhitelist()
    {
        $data           = array();
        $uncoveredFiles = array_diff(
            $this->filter->getWhitelist(),
            array_keys($this->data)
        );

        foreach ($uncoveredFiles as $uncoveredFile) {
            if (!file_exists($uncoveredFile)) {
                continue;
            }

            if ($this->processUncoveredFilesFromWhitelist) {
                $this->processUncoveredFileFromWhitelist(
                    $uncoveredFile,
                    $data,
                    $uncoveredFiles
                );
            } else {
                $data[$uncoveredFile] = array();

                $lines = count(file($uncoveredFile));

                for ($i = 1; $i <= $lines; $i++) {
                    $data[$uncoveredFile][$i] = -1;
                }
            }
        }

        $this->append($data, 'UNCOVERED_FILES_FROM_WHITELIST');
    }
開發者ID:harish94,項目名稱:Craft-Release,代碼行數:35,代碼來源:CodeCoverage.php

示例2: processUncoveredFilesFromWhitelist

 /**
  * Processes whitelisted files that are not covered.
  */
 protected function processUncoveredFilesFromWhitelist()
 {
     $data = array();
     $uncoveredFiles = array_diff($this->filter->getWhitelist(), array_keys($this->coveredFiles));
     $newVariables = array();
     $newVariableNames = array();
     $oldVariableNames = array();
     $uncoveredFile = NULL;
     $variableName = NULL;
     foreach ($uncoveredFiles as $uncoveredFile) {
         if ($this->promoteGlobals) {
             $oldVariableNames = array_keys(get_defined_vars());
         }
         $this->driver->start();
         include_once $uncoveredFile;
         $coverage = $this->driver->stop();
         if ($this->promoteGlobals) {
             $newVariables = get_defined_vars();
             $newVariableNames = array_diff(array_keys($newVariables), $oldVariableNames);
             foreach ($newVariableNames as $variableName) {
                 if ($variableName != 'oldVariableNames') {
                     $GLOBALS[$variableName] = $newVariables[$variableName];
                 }
             }
         }
         foreach ($coverage as $file => $fileCoverage) {
             if (!isset($data[$file])) {
                 $data[$file] = $fileCoverage;
             }
         }
     }
     $this->append($data, 'UNCOVERED_FILES_FROM_WHITELIST');
 }
開發者ID:rdohms,項目名稱:php-code-coverage,代碼行數:36,代碼來源:CodeCoverage.php

示例3: processUncoveredFilesFromWhitelist

 /**
  * Processes whitelisted files that are not covered.
  */
 protected function processUncoveredFilesFromWhitelist()
 {
     $data = array();
     $uncoveredFiles = array_diff($this->filter->getWhitelist(), array_keys($this->data));
     foreach ($uncoveredFiles as $uncoveredFile) {
         if (!file_exists($uncoveredFile)) {
             continue;
         }
         if ($this->cacheTokens) {
             $tokens = PHP_Token_Stream_CachingFactory::get($uncoveredFile);
         } else {
             $tokens = new PHP_Token_Stream($uncoveredFile);
         }
         $classes = $tokens->getClasses();
         $interfaces = $tokens->getInterfaces();
         $functions = $tokens->getFunctions();
         unset($tokens);
         foreach (array_keys($classes) as $class) {
             if (class_exists($class, FALSE)) {
                 continue 2;
             }
         }
         unset($classes);
         foreach (array_keys($interfaces) as $interface) {
             if (interface_exists($interface, FALSE)) {
                 continue 2;
             }
         }
         unset($interfaces);
         foreach (array_keys($functions) as $function) {
             if (function_exists($function)) {
                 continue 2;
             }
         }
         unset($functions);
         $this->driver->start();
         include_once $uncoveredFile;
         $coverage = $this->driver->stop();
         foreach ($coverage as $file => $fileCoverage) {
             if (!isset($data[$file]) && in_array($file, $uncoveredFiles)) {
                 foreach (array_keys($fileCoverage) as $key) {
                     if ($fileCoverage[$key] == 1) {
                         $fileCoverage[$key] = -1;
                     }
                 }
                 $data[$file] = $fileCoverage;
             }
         }
     }
     $this->append($data, 'UNCOVERED_FILES_FROM_WHITELIST');
 }
開發者ID:qube81,項目名稱:old-phpunit,代碼行數:54,代碼來源:CodeCoverage.php

示例4: processUncoveredFilesFromWhitelist

 /**
  * Processes whitelisted files that are not covered.
  */
 protected function processUncoveredFilesFromWhitelist()
 {
     $data = array();
     $includedFiles = array_flip(get_included_files());
     $uncoveredFiles = array_diff($this->filter->getWhitelist(), $this->coveredFiles);
     foreach ($uncoveredFiles as $uncoveredFile) {
         if (isset($includedFiles[$uncoveredFile])) {
             foreach (array_keys($this->data) as $test) {
                 if (isset($this->data[$test]['raw'][$uncoveredFile])) {
                     $coverage = $this->data[$test]['raw'][$uncoveredFile];
                     foreach (array_keys($coverage) as $key) {
                         if ($coverage[$key] == 1) {
                             $coverage[$key] = -1;
                         }
                     }
                     $data[$uncoveredFile] = $coverage;
                     break;
                 }
             }
         } else {
             $this->driver->start();
             include_once $uncoveredFile;
             $coverage = $this->driver->stop();
             foreach ($coverage as $file => $fileCoverage) {
                 if (!isset($data[$file]) && in_array($file, $uncoveredFiles)) {
                     foreach (array_keys($fileCoverage) as $key) {
                         if ($fileCoverage[$key] == 1) {
                             $fileCoverage[$key] = -1;
                         }
                     }
                     $data[$file] = $fileCoverage;
                     $includedFiles[$file] = TRUE;
                 }
             }
         }
     }
     $this->append($data, 'UNCOVERED_FILES_FROM_WHITELIST');
 }
開發者ID:reflectivedevelopment,項目名稱:jfh-lib,代碼行數:41,代碼來源:CodeCoverage.php


注:本文中的PHP_CodeCoverage_Filter::getWhitelist方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。