Skip to content
Permalink
Browse files

Line coverage changes in tests for PHP 7.4 (part #1)

  • Loading branch information...
derickr committed Jun 4, 2019
1 parent c9e1554 commit 9b67283459b3e7e27c07ec6829be9ffd8369c336
@@ -1,9 +1,9 @@
--TEST--
Test for bug #212: coverage coverage inaccurate (3) (> PHP 7.0.12)
Test for bug #212: coverage coverage inaccurate (3) (> PHP 7.0.12, < PHP 7.4)
--SKIPIF--
<?php
require 'tests/utils.inc';
check_reqs('PHP > 7.0.12');
check_reqs('PHP > 7.0.12,< 7.4');
?>
--INI--
xdebug.default_enable=1
@@ -0,0 +1,37 @@
--TEST--
Test for bug #212: coverage coverage inaccurate (3) (>= PHP 7.4)
--SKIPIF--
<?php
require 'tests/utils.inc';
check_reqs('PHP >= 7.4');
?>
--INI--
xdebug.default_enable=1
xdebug.auto_trace=0
xdebug.trace_options=0
xdebug.trace_output_dir=/tmp
xdebug.collect_params=1
xdebug.collect_return=0
xdebug.auto_profile=0
xdebug.profiler_enable=0
xdebug.dump_globals=0
xdebug.show_mem_delta=0
xdebug.trace_format=0
xdebug.overload_var_dump=0
--FILE--
<?php
xdebug_start_code_coverage( XDEBUG_CC_UNUSED | XDEBUG_CC_DEAD_CODE );
$file = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'bug00212c.inc';
include $file;
$cc = xdebug_get_code_coverage();
xdebug_stop_code_coverage();
var_dump($cc[$file]);
?>
--EXPECT--
Hello World
array(2) {
[10]=>
int(1)
[12]=>
int(1)
}
@@ -1,9 +1,9 @@
--TEST--
Test for bug #470: catch blocks marked as dead code unless executed (> PHP 7.0.12)
Test for bug #470: catch blocks marked as dead code unless executed (> PHP 7.0.12, < PHP 7.4)
--SKIPIF--
<?php
require 'tests/utils.inc';
check_reqs('PHP > 7.0.12');
check_reqs('PHP > 7.0.12,< 7.4');
?>
--INI--
xdebug.default_enable=1
@@ -0,0 +1,68 @@
--TEST--
Test for bug #470: catch blocks marked as dead code unless executed (>= PHP 7.4)
--SKIPIF--
<?php
require 'tests/utils.inc';
check_reqs('PHP >= 7.4');
?>
--INI--
xdebug.default_enable=1
xdebug.auto_trace=0
xdebug.trace_options=0
xdebug.trace_output_dir=/tmp
xdebug.collect_params=1
xdebug.collect_return=0
xdebug.collect_assignments=0
xdebug.auto_profile=0
xdebug.profiler_enable=0
xdebug.dump_globals=0
xdebug.show_mem_delta=0
xdebug.trace_format=0
xdebug.overload_var_dump=0
--FILE--
<?php
xdebug_start_code_coverage(XDEBUG_CC_UNUSED | XDEBUG_CC_DEAD_CODE);
include 'bug00470.inc';
$cc = xdebug_get_code_coverage();
ksort($cc);
var_dump(array_slice($cc, 1, 1));
new Ticket842;
$cc = xdebug_get_code_coverage();
ksort($cc);
var_dump(array_slice($cc, 1, 1));
xdebug_stop_code_coverage(false);
?>
--EXPECTF--
array(1) {
["%sbug00470.inc"]=>
array(5) {
[6]=>
int(-1)
[8]=>
int(-1)
[9]=>
int(-1)
[11]=>
int(-1)
[14]=>
int(1)
}
}
array(1) {
["%sbug00470.inc"]=>
array(5) {
[6]=>
int(1)
[8]=>
int(-1)
[9]=>
int(-1)
[11]=>
int(1)
[14]=>
int(1)
}
}
@@ -1,9 +1,9 @@
--TEST--
Test for bug #472: Dead Code Analysis for code coverage messed up after goto (> PHP 7.0.12, !opcache)
Test for bug #472: Dead Code Analysis for code coverage messed up after goto (> PHP 7.0.12, < PHP 7.4, !opcache)
--SKIPIF--
<?php
require 'tests/utils.inc';
check_reqs('PHP > 7.0.12; !opcache');
check_reqs('PHP > 7.0.12,< 7.4; !opcache');
?>
--INI--
xdebug.default_enable=1
@@ -0,0 +1,179 @@
--TEST--
Test for bug #472: Dead Code Analysis for code coverage messed up after goto (>= PHP 7.4, !opcache)
--SKIPIF--
<?php
require 'tests/utils.inc';
check_reqs('PHP >= 7.4; !opcache');
?>
--INI--
xdebug.default_enable=1
xdebug.auto_trace=0
xdebug.trace_options=0
xdebug.trace_output_dir=/tmp
xdebug.collect_params=1
xdebug.collect_return=0
xdebug.collect_assignments=0
xdebug.auto_profile=0
xdebug.profiler_enable=0
xdebug.dump_globals=0
xdebug.show_mem_delta=0
xdebug.trace_format=0
xdebug.coverage_enable=1
xdebug.overload_var_dump=0
--FILE--
<?php
xdebug_start_code_coverage(XDEBUG_CC_UNUSED | XDEBUG_CC_DEAD_CODE);
include 'bug00472.inc';
$cc = xdebug_get_code_coverage();
ksort($cc);
var_dump(array_slice($cc, 1, 1));
xdebug_stop_code_coverage(false);
?>
--EXPECTF--
array(1) {
["%sbug00472.inc"]=>
array(70) {
[9]=>
int(-1)
[10]=>
int(-1)
[13]=>
int(-1)
[14]=>
int(-1)
[15]=>
int(-1)
[18]=>
int(-1)
[19]=>
int(-1)
[20]=>
int(-1)
[23]=>
int(-1)
[24]=>
int(-1)
[25]=>
int(-1)
[26]=>
int(-1)
[29]=>
int(-1)
[30]=>
int(-1)
[31]=>
int(-1)
[34]=>
int(-1)
[35]=>
int(-1)
[38]=>
int(-1)
[40]=>
int(-1)
[41]=>
int(-1)
[42]=>
int(-1)
[43]=>
int(-1)
[45]=>
int(-1)
[46]=>
int(-1)
[50]=>
int(-1)
[51]=>
int(-1)
[52]=>
int(-1)
[54]=>
int(-1)
[55]=>
int(-1)
[56]=>
int(-1)
[57]=>
int(-1)
[58]=>
int(-1)
[59]=>
int(-1)
[60]=>
int(-1)
[65]=>
int(-1)
[66]=>
int(-1)
[67]=>
int(-1)
[68]=>
int(-1)
[70]=>
int(-1)
[71]=>
int(-1)
[72]=>
int(-1)
[73]=>
int(-1)
[74]=>
int(-1)
[75]=>
int(-1)
[76]=>
int(-1)
[82]=>
int(-1)
[83]=>
int(-1)
[84]=>
int(-1)
[85]=>
int(-1)
[87]=>
int(-1)
[88]=>
int(-1)
[93]=>
int(-1)
[94]=>
int(-1)
[95]=>
int(-1)
[96]=>
int(-1)
[98]=>
int(-1)
[99]=>
int(-1)
[100]=>
int(-1)
[101]=>
int(-1)
[102]=>
int(-1)
[103]=>
int(-1)
[104]=>
int(-1)
[112]=>
int(-1)
[113]=>
int(-1)
[115]=>
int(-1)
[116]=>
int(-1)
[118]=>
int(-1)
[119]=>
int(-1)
[120]=>
int(-2)
[122]=>
int(1)
}
}
@@ -38,7 +38,7 @@ array(1) {
array(9) {
[2]=>
int(1)
[3]=>
[%r(3|5)%r]=>
int(1)
[9]=>
int(-1)
@@ -1,5 +1,10 @@
--TEST--
Test for bug #535: Code coverage and return before function|class ending
Test for bug #535: Code coverage and return before function|class ending (< PHP 7.4)
--SKIPIF--
<?php
require 'tests/utils.inc';
check_reqs('PHP < 7.4');
?>
--INI--
xdebug.overload_var_dump=0
--FILE--
@@ -20,7 +25,7 @@ var_dump(xdebug_get_code_coverage());
?>
--EXPECTF--
array(1) {
["%sbug00535-php7.php"]=>
["%sbug00535-php70.php"]=>
array(5) {
[4]=>
int(1)
@@ -0,0 +1,40 @@
--TEST--
Test for bug #535: Code coverage and return before function|class ending (>= PHP 7.4)
--SKIPIF--
<?php
require 'tests/utils.inc';
check_reqs('PHP >= 7.4');
?>
--INI--
xdebug.overload_var_dump=0
--FILE--
<?php
xdebug_start_code_coverage();
class test
{
function a() {
return true;
}
}
$a = new test();
$a->a();
var_dump(xdebug_get_code_coverage());
?>
--EXPECTF--
array(1) {
["%sbug00535-php74.php"]=>
array(4) {
[7]=>
int(1)
[11]=>
int(1)
[12]=>
int(1)
[14]=>
int(1)
}
}

0 comments on commit 9b67283

Please sign in to comment.
You can’t perform that action at this time.