Class BaseCoverageReport
Abstract class for common CoverageReport methods. Provides several template methods for custom output.
Direct Subclasses
Package: Cake\TestSuite\Coverage
Copyright: Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
License: License (http://www.opensource.org/licenses/mit-license.php)
Location: Cake/TestSuite/Coverage/BaseCoverageReport.php
Properties summary
- 
			
$_rawCoverageprotectedstringcoverage data - 
			
$_testNamesprotectedarrayArray of test case file names. Used to do basename() matching with files that have coverage to decide which results to show on page load.
 - 
			
$appTestpublicstringis the test an app test - 
			
$pluginTestpublicstringis the test a plugin test 
Method Summary
- 
			
__construct() public
Constructor - 
			
_calculateCoveredLines() protected
Calculates how many lines are covered and what the total number of executable lines is. - 
			
filterCoverageDataByPath() public
Filters the coverage data by path. Files not in the provided path will be removed. - 
			
generateDiff() abstract public
Generates an coverage 'diff' for $file based on $coverageData. - 
			
getPathFilter() public
Gets the base path that the files we are interested in live in. - 
			
report() abstract public
Generates report to display. - 
			
setCoverage() public
Set the coverage data array - 
			
setParams() protected
Pulls params out of the reporter. 
Method Detail
__construct() 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() 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
 - array $coverageData
 
Returns
Array of covered, total lines.
filterCoverageDataByPath() 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
Array of coverage data for files that match the given path.
generateDiff() 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
prepared report for a single file.
getPathFilter() public ¶
getPathFilter( )
Gets the base path that the files we are interested in live in.
report() abstract public ¶
report( )
Generates report to display.
Returns
compiled html report.
setCoverage() public ¶
setCoverage( array $coverage )
Set the coverage data array
Parameters
- array $coverage
 - Coverage data to use.
 
setParams() protected ¶
setParams( CakeBaseReporter $reporter )
		
Pulls params out of the reporter.
Parameters
- 
						
CakeBaseReporter$reporter - Reporter to suck params out of.
 
Properties detail
$_testNames ¶
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()