Xdebug document (5) code coverage analysis, xdebug document _ PHP Tutorial

Source: Internet
Author: User
Xdebug document (5) code coverage analysis and xdebug document. Xdebug (5) code overwrite analysis. the code overwrite analysis in xdebug allows you to know which line (or segment) of the script is being executed during the request. Relevant settings xdebug. coverage_enab Xdebug documentation (5) code coverage analysis, xdebug documentation

Code overwrite analysis allows you to know which line (or segment) of the script is being executed during the request.

Settings

Xdebug. coverage_enable

Type:Boolean, Default value:1, Starts

Xdebug> = 2.2

If it is set to 0, Xdebug does not set the built-in structure to allow code analysis, which can accelerate xdebug faster, but the code coverage analysis will not work.

Related functions BooleanXdebug_code_coverage_started ()

Return a Boolean value to check whether the code overwrite analysis has started.

Example:

   

Returns:

bool(false)
bool(true)
 

ArrayXdebug_get_code_coverage ()

Returns the line containing the script in the structure (including the referenced file. The following code overwrites a specified file:

Example:

   

Returns:

Array

'/Home/httpd/html/test/xdebug/docs/xdebug_get_code_coverage.php' =>

Array

5 => int 1

6 => int 1

7 => int 1

9 => int 1

10 => int 1

11 => int 1

12 => int 1

13 => int 1

15 => int 1

16 => int 1

18 => int 1

VoidXdebug_start_code_coverage ([Int options])

Start code coverage analysis

This function starts to collect code overwrite information. This information is formed by two-dimensional arrays, and the one-dimensional index is the second-level index of the execution file name as the row number. The element value indicates whether the row is executed or whether it has rows that cannot be reached.

Values returned for each row:

  • 1: This row has been executed
  • -1: The row is not executed.
  • -2: This row does not have executable code.

-The value 1 is returned only when XDEBUG_CC_UNUSED is enabled. The value-2 is returned only when XDEBUG_CC_UNUSED and XDEBUG_CC_DEAD_CODE are enabled at the same time.

The function has two options with enumerated values:

XDEBUG_CC_UNUSED

Enable detection code and describe the code that can be executed. If this option is not specified, the returned array only contains the actually executed row number.

XDEBUG_CC_DEAD_CODE

Start an additional analysis to explain which code can be executed.

If these options are enabled, code overwrite analysis is greatly slowed down.

The following example shows how to use the options:

Example:

 

VoidXdebug_stop_code_coverage ([Int cleanup = true])

Stop code coverage analysis

This function stops collecting information, which is cleared in memory. If you pass the "false" parameter, the code overwrite information will not be cleared and you can use it again.Xdebug_start_code_coverage ()Recover information collection.

Coverage (5) code coverage analysis. the code coverage analysis in the xdebug document allows you to know which line (or segment) of the script is being executed during the request. Related settings xdebug. coverage_enab...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.