本文整理汇总了PHP中PHP_CodeCoverage_Util::getLinesToBeCovered方法的典型用法代码示例。如果您正苦于以下问题:PHP PHP_CodeCoverage_Util::getLinesToBeCovered方法的具体用法?PHP PHP_CodeCoverage_Util::getLinesToBeCovered怎么用?PHP PHP_CodeCoverage_Util::getLinesToBeCovered使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHP_CodeCoverage_Util
的用法示例。
在下文中一共展示了PHP_CodeCoverage_Util::getLinesToBeCovered方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: applyCoversAnnotationFilter
/**
* Applies the @covers annotation filtering.
*
* @param array $data
* @param mixed $id
*/
protected function applyCoversAnnotationFilter(&$data, $id)
{
if ($id instanceof PHPUnit_Framework_TestCase) {
$testClassName = get_class($id);
$linesToBeCovered = PHP_CodeCoverage_Util::getLinesToBeCovered($testClassName, $id->getName());
if ($this->mapTestClassNameToCoveredClassName && empty($linesToBeCovered)) {
$testedClass = substr($testClassName, 0, -4);
if (class_exists($testedClass)) {
$class = new ReflectionClass($testedClass);
$linesToBeCovered = array($class->getFileName() => range($class->getStartLine(), $class->getEndLine()));
}
}
} else {
$linesToBeCovered = array();
}
if (!empty($linesToBeCovered)) {
$data = array_intersect_key($data, $linesToBeCovered);
foreach (array_keys($data) as $filename) {
$data[$filename] = array_intersect_key($data[$filename], array_flip($linesToBeCovered[$filename]));
}
} else {
if ($this->forceCoversAnnotation) {
$data = array();
}
}
}
示例2: testGetLinesToBeCovered4
/**
* @covers PHP_CodeCoverage_Util::getLinesToBeCovered
* @covers PHP_CodeCoverage_Util::resolveCoversToReflectionObjects
* @expectedException RuntimeException
*/
public function testGetLinesToBeCovered4()
{
PHP_CodeCoverage_Util::getLinesToBeCovered('NotExistingCoveredElementTest', 'testThree');
}