Class BaseCoverageReport
Abstract class for common CoverageReport methods. Provides several template methods for custom output.
Direct Subclasses
Package: Cake\TestSuite\Coverage
Copyright: Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
License: MIT License
Location: Cake/TestSuite/Coverage/BaseCoverageReport.php
Properties summary
-
$_rawCoverage
protectedcoverage datastring
-
$_testNames
protectedarray
Array of test case file names. Used to do basename() matching with files that have coverage to decide which results to show on page load.
-
$appTest
publicis the test an app teststring
-
$pluginTest
publicis the test a plugin teststring
Method Summary
- __construct() publicConstructor
- _calculateCoveredLines() protectedCalculates how many lines are covered and what the total number of executable lines is.
- _setParams() protectedPulls params out of the reporter.
- filterCoverageDataByPath() publicFilters the coverage data by path. Files not in the provided path will be removed.
- Generates an coverage 'diff' for $file based on $coverageData.
- getPathFilter() publicGets the base path that the files we are interested in live in.
- Generates report to display.
- setCoverage() publicSet the coverage data array
Method Detail
__construct()source public
__construct( array $coverage , CakeBaseReporter $reporter )
Constructor
Parameters
- array
$coverage
- Array of coverage data from PHPUnit_Test_Result
-
CakeBaseReporter
$reporter
- A reporter to use for the coverage report.
_calculateCoveredLines()source protected
_calculateCoveredLines( array $fileLines , array $coverageData )
Calculates how many lines are covered and what the total number of executable lines is.
Handles both PHPUnit3.5 and 3.6 formats.
3.5 uses -1 for uncovered, and -2 for dead. 3.6 uses array() for uncovered and null for dead.
Parameters
- array
$fileLines
- The lines in the file.
- array
$coverageData
- The raw coverage data.
Returns
arrayArray of covered, total lines.
_setParams()source protected
_setParams( CakeBaseReporter $reporter )
Pulls params out of the reporter.
Parameters
-
CakeBaseReporter
$reporter
- Reporter to suck params out of.
filterCoverageDataByPath()source public
filterCoverageDataByPath( string $path )
Filters the coverage data by path. Files not in the provided path will be removed.
Parameters
- string
$path
- Path to filter files by.
Returns
arrayArray of coverage data for files that match the given path.
generateDiff()source abstract public
generateDiff( string $filename , array $fileLines , array $coverageData )
Generates an coverage 'diff' for $file based on $coverageData.
Parameters
- string
$filename
- Name of the file having coverage generated
- array
$fileLines
- File data as an array. See file() for how to get one of these.
- array
$coverageData
- Array of coverage data to use to generate HTML diffs with
Returns
stringprepared report for a single file.
getPathFilter()source public
getPathFilter( )
Gets the base path that the files we are interested in live in.
Returns
stringPath
report()source abstract public
report( )
Generates report to display.
Returns
stringcompiled html report.
setCoverage()source public
setCoverage( array $coverage )
Set the coverage data array
Parameters
- array
$coverage
- Coverage data to use.
Properties detail
$_testNamessource
protected array
Array of test case file names. Used to do basename() matching with files that have coverage to decide which results to show on page load.
array()
© 2005–2017 The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
https://api.cakephp.org/2.10/class-BaseCoverageReport.html