CakePHP
  • Documentation
    • Book
    • API
    • Videos
    • Reporting Security Issues
    • Privacy Policy
    • Logos & Trademarks
  • Business Solutions
  • Swag
  • Road Trip
  • Team
  • Community
    • Community
    • Get Involved
    • Issues (GitHub)
    • Bakery
    • Featured Resources
    • Training
    • Meetups
    • My CakePHP
    • CakeFest
    • Newsletter
    • Linkedin
    • YouTube
    • Facebook
    • Twitter
    • Mastodon
    • Help & Support
    • Forum
    • Stack Overflow
    • Slack
    • Paid Support
CakePHP

C CakePHP 2.2 API

  • Overview
  • Tree
  • Deprecated
  • Version:
    • 2.2
      • 4.2
      • 4.1
      • 4.0
      • 3.9
      • 3.8
      • 3.7
      • 3.6
      • 3.5
      • 3.4
      • 3.3
      • 3.2
      • 3.1
      • 3.0
      • 2.10
      • 2.9
      • 2.8
      • 2.7
      • 2.6
      • 2.5
      • 2.4
      • 2.3
      • 2.2
      • 2.1
      • 2.0
      • 1.3
      • 1.2

Packages

  • Cake
    • Cache
      • Engine
    • Configure
    • Console
      • Command
        • Task
    • Controller
      • Component
        • Acl
        • Auth
    • Core
    • Error
    • Event
    • I18n
    • Log
      • Engine
    • Model
      • Behavior
      • Datasource
        • Database
        • Session
      • Validator
    • Network
      • Email
      • Http
    • Routing
      • Filter
      • Route
    • TestSuite
      • Coverage
      • Fixture
      • Reporter
    • Utility
    • View
      • Helper

Classes

  • BaseCoverageReport
  • HtmlCoverageReport
  • TextCoverageReport

Class HtmlCoverageReport

Generates code coverage reports in HTML from data obtained from PHPUnit

BaseCoverageReport
Extended by HtmlCoverageReport
Package: Cake\TestSuite\Coverage
Copyright: Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
License: License (http://www.opensource.org/licenses/mit-license.php)
Location: Cake/TestSuite/Coverage/HtmlCoverageReport.php

Inherited Properties

  • _rawCoverage, _testNames, appTest, pluginTest

Method Summary

  • _guessSubjectName() protected
    Guess the classname the test was for based on the test case filename.
  • _paintLine() protected
    Renders the html for a single line in the html diff.
  • coverageFooter() public
    Generate an HTML snippet for coverage footers
  • coverageHeader() public
    Generate an HTML snippet for coverage headers
  • coverageScript() public
    generate some javascript for the coverage report.
  • generateDiff() public
    Generates an HTML diff for $file based on $coverageData.
  • report() public
    Generates report html to display.

Method Detail

_guessSubjectName() protected ¶

_guessSubjectName( ReflectionClass $testReflection )

Guess the classname the test was for based on the test case filename.

Parameters
ReflectionClass $testReflection
$testReflection.
Returns
string
Possible test subject name.

_paintLine() protected ¶

_paintLine( $line , $linenumber , $class , $coveringTests )

Renders the html for a single line in the html diff.

coverageFooter() public ¶

coverageFooter( )

Generate an HTML snippet for coverage footers

coverageHeader() public ¶

coverageHeader( $filename , $percent )

Generate an HTML snippet for coverage headers

coverageScript() public ¶

coverageScript( )

generate some javascript for the coverage report.

generateDiff() public ¶

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

Generates an HTML diff for $file based on $coverageData.

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
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
HTML diff.

report() public ¶

report( )

Generates report html to display.

Returns
string
compiled html report.

Methods inherited from BaseCoverageReport

__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.
Array of covered, total lines.

_setParams() protected ¶

_setParams( CakeBaseReporter $reporter )

Pulls params out of the reporter.

Parameters
CakeBaseReporter $reporter
Reporter to suck params out of.

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

getPathFilter() public ¶

getPathFilter( )

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

setCoverage() public ¶

setCoverage( array $coverage )

Set the coverage data array

Parameters
array $coverage
Coverage data to use.
OpenHub
Rackspace
Rackspace
  • Business Solutions
  • Showcase
  • Documentation
  • Book
  • API
  • Videos
  • Reporting Security Issues
  • Privacy Policy
  • Logos & Trademarks
  • Community
  • Get Involved
  • Issues (GitHub)
  • Bakery
  • Featured Resources
  • Training
  • Meetups
  • My CakePHP
  • CakeFest
  • Newsletter
  • Linkedin
  • YouTube
  • Facebook
  • Twitter
  • Mastodon
  • Help & Support
  • Forum
  • Stack Overflow
  • Slack
  • Paid Support

Generated using CakePHP API Docs