TextCoverageReport (class)

Class TextCoverageReport

Generates code coverage reports in Simple plain text from data obtained from PHPUnit

BaseCoverageReport
Extended by TextCoverageReport
Package: Cake\TestSuite\Coverage
Copyright: Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
License: MIT License
Located at Cake/TestSuite/Coverage/TextCoverageReport.php

Method Detail

generateDiffsource public

generateDiff( string $filename , array $fileLines , array $coverageData )

Generates a 'diff' report for a file. Since diffs are too big for plain text reports a simple file => % covered is done.

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

string
string

reportsource public

report( )

Generates report text to display.

Returns

string
compiled plain text report.

Methods inherited from BaseCoverageReport

__constructsource 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.

_calculateCoveredLinessource 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

array
Array of covered, total lines.

_setParamssource protected

_setParams( CakeBaseReporter $reporter )

Pulls params out of the reporter.

Parameters

CakeBaseReporter $reporter
Reporter to suck params out of.

filterCoverageDataByPathsource 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
Array of coverage data for files that match the given path.

getPathFiltersource public

getPathFilter( )

Gets the base path that the files we are interested in live in.

Returns

string
Path

setCoveragesource public

setCoverage( array $coverage )

Set the coverage data array

Parameters

array $coverage
Coverage data to use.

Properties inherited from BaseCoverageReport

$_rawCoveragesource

protected string

coverage data

$_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()

$appTestsource

public string

is the test an app test

false

$pluginTestsource

public string

is the test a plugin test

false

© 2005–2016 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.
http://api.cakephp.org/2.7/class-TextCoverageReport.html

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部