PHP Class lithium\test\filter\Coverage

Inheritance: extends lithium\test\Filter
Show file Open project: unionofrad/lithium

Public Methods

Method Description
analyze ( object $report, array $classes = [] ) : array Analyzes code coverage results collected from XDebug, and performs coverage density analysis.
apply ( object $report, array $tests, array $options = [] ) : object Takes an instance of an object (usually a Collection object) containing test instances. Attaches code coverage filtering to test cases.
collect ( array $filterResults, array $options = [] ) : array Collects code coverage analysis results from xdebug_get_code_coverage().
collectLines ( array $result ) : array Takes the raw line numbers and returns results with the code from uncovered lines included.

Protected Methods

Method Description
_density ( array $runs, array $classMap = [] ) : array Reduces the results of multiple XDebug code coverage runs into a single 2D array of the aggregate line coverage density per file.

Method Details

_density() protected static method

Reduces the results of multiple XDebug code coverage runs into a single 2D array of the aggregate line coverage density per file.
protected static _density ( array $runs, array $classMap = [] ) : array
$runs array An array containing multiple runs of raw XDebug coverage data, where each array key is a file name, and its value is XDebug's coverage data for that file.
$classMap array An optional map with class names as array keys and corresponding file names as values. Used to filter the returned results, and will cause the array keys of the results to be class names instead of file names.
return array

analyze() public static method

Analyzes code coverage results collected from XDebug, and performs coverage density analysis.
public static analyze ( object $report, array $classes = [] ) : array
$report object The report instance running this filter and aggregating results
$classes array 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 Returns an array indexed by file and line, showing the number of instances each line was called.

apply() public static method

Takes an instance of an object (usually a Collection object) containing test instances. Attaches code coverage filtering to test cases.
See also: lithium\test\filter\Coverage::collect()
public static apply ( object $report, array $tests, array $options = [] ) : object
$report object Instance of Report which is calling apply.
$tests array The test to apply this filter on
$options array Options for how code coverage should be applied. These options are also passed to `Coverage::collect()` to determine how to aggregate results. See the documentation for `collect()` for further options. Options affecting this method are: -'method': The name of method to attach to, defaults to 'run'.
return object Returns the instance of `$tests` with code coverage analysis triggers applied.

collect() public static method

Collects code coverage analysis results from xdebug_get_code_coverage().
See also: lithium\test\filter\Coverage::analyze()
public static collect ( array $filterResults, array $options = [] ) : array
$filterResults array An array of results arrays from `xdebug_get_code_coverage()`.
$options array Set of options defining how results should be collected.
return array The packaged filter results.

collectLines() public static method

Takes the raw line numbers and returns results with the code from uncovered lines included.
public static collectLines ( array $result ) : array
$result array The raw line number results
return array