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


PHP Inspector::executable方法代碼示例

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


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

示例1: analyze

 /**
  * Analyzes code coverage results collected from XDebug, and performs coverage density analysis.
  *
  * @param object $report The report instance running this filter and aggregating results
  * @param array $classes A list of classes to analyze coverage on. By default, gets all
  *              defined subclasses of lithium\test\Unit which are currently in memory.
  * @return array|void Returns an array indexed by file and line, showing the number of
  *                    instances each line was called.
  */
 public static function analyze($report, array $classes = array())
 {
     $data = static::collect($report->results['filters'][__CLASS__]);
     $classes = $classes ?: array_filter(get_declared_classes(), function ($class) use($data) {
         $unit = 'lithium\\test\\Unit';
         return !is_subclass_of($class, $unit) || array_key_exists($class, $data);
     });
     $classes = array_values(array_intersect((array) $classes, array_keys($data)));
     $densities = $result = array();
     foreach ($classes as $class) {
         $classMap = array($class => Libraries::path($class));
         $densities += static::_density($data[$class], $classMap);
     }
     $executableLines = array();
     if (!empty($classes)) {
         $executableLines = array_combine($classes, array_map(function ($cls) {
             return Inspector::executable($cls, array('public' => false));
         }, $classes));
     }
     foreach ($densities as $class => $density) {
         $executable = $executableLines[$class];
         $covered = array_intersect(array_keys($density), $executable);
         $uncovered = array_diff($executable, $covered);
         $percentage = round(count($covered) / (count($executable) ?: 1), 4) * 100;
         $result[$class] = compact('class', 'executable', 'covered', 'uncovered', 'percentage');
     }
     $result = static::collectLines($result);
     return $result;
 }
開發者ID:EHER,項目名稱:chegamos,代碼行數:38,代碼來源:Coverage.php

示例2: testExecutableLines

 /**
  * Gets the executable line numbers of this file based on a manual entry of line ranges. Will
  * need to be updated manually if this method changes.
  *
  * @return void
  */
 public function testExecutableLines()
 {
     do {
         // These lines should be ignored
     } while (false);
     $result = Inspector::executable($this, array('methods' => __FUNCTION__));
     $expected = array(__LINE__ - 1, __LINE__, __LINE__ + 1);
     $this->assertEqual($expected, $result);
 }
開發者ID:WarToaster,項目名稱:HangOn,代碼行數:15,代碼來源:InspectorTest.php

示例3: testExecutableLinesOnEmptyClass

 public function testExecutableLinesOnEmptyClass()
 {
     $result = Inspector::executable(new MockEmptyClass());
     $this->assertEqual(array(), $result);
 }
開發者ID:fedeisas,項目名稱:lithium,代碼行數:5,代碼來源:InspectorTest.php


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