Skip to content
Permalink
Browse files

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

  • Loading branch information...
derickr committed Jun 8, 2019
1 parent b54afe7 commit f0d91d4f9af94a7b86fef9f37e510318f921f116
@@ -1,9 +1,9 @@
--TEST--
Test for bug #879: Closing brace in trait-using class definitions is counted towards code coverage (> PHP 7.0.12)
Test for bug #879: Closing brace in trait-using class definitions is counted towards code coverage (> PHP 7.0.12, < PHP 7.4)
--SKIPIF--
<?php
require __DIR__ . '/utils.inc';
check_reqs('PHP > 7.0.12');
check_reqs('PHP > 7.0.12,< 7.4');
?>
--INI--
xdebug.default_enable=1
@@ -0,0 +1,57 @@
--TEST--
Test for bug #879: Closing brace in trait-using class definitions is counted towards code coverage (>= PHP 7.4)
--SKIPIF--
<?php
require __DIR__ . '/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.coverage_enable=1
xdebug.overload_var_dump=0
--FILE--
<?php
xdebug_start_code_coverage(XDEBUG_CC_UNUSED);
$file = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'bug00879.inc';
include $file;
new WithTrait;
$cc = xdebug_get_code_coverage();
ksort($cc);
var_dump($cc);
?>
--EXPECTF--
array(2) {
["%sbug00879-php74.php"]=>
array(4) {
[5]=>
int(1)
[6]=>
int(1)
[8]=>
int(1)
[10]=>
int(1)
}
["%sbug00879.inc"]=>
array(2) {
[5]=>
int(1)
[8]=>
int(1)
}
}
@@ -23,7 +23,7 @@ var_dump($c);
before true
Do somthing
array(2) {
["%sbug01241-002-php71.php"]=>
["%sbug01241-002-php74.php"]=>
array(4) {
[4]=>
int(1)
@@ -1,9 +1,9 @@
--TEST--
Test for bug #1270: String parsing marked not covered (> PHP 7.1.3, !opcache)
Test for bug #1270: String parsing marked not covered (> PHP 7.1.3, < PHP 7.4, !opcache)
--SKIPIF--
<?php
require __DIR__ . '/utils.inc';
check_reqs('PHP > 7.1.3; !opcache');
check_reqs('PHP > 7.1.3,< 7.4; !opcache');
?>
--FILE--
<?php
@@ -1,9 +1,9 @@
--TEST--
Test for bug #1270: String parsing marked not covered (>= PHP 7.2, opcache)
Test for bug #1270: String parsing marked not covered (>= PHP 7.2, < PHP 7.4, opcache)
--SKIPIF--
<?php
require __DIR__ . '/utils.inc';
check_reqs('PHP >= 7.2; opcache');
check_reqs('PHP >= 7.2,< 7.4; opcache');
?>
--FILE--
<?php
@@ -0,0 +1,48 @@
--TEST--
Test for bug #1270: String parsing marked not covered (>= PHP 7.4, opcache)
--SKIPIF--
<?php
require __DIR__ . '/utils.inc';
check_reqs('PHP >= 7.4; opcache');
?>
--FILE--
<?php
xdebug_start_code_coverage( XDEBUG_CC_UNUSED | XDEBUG_CC_DEAD_CODE );
include dirname( __FILE__ ) . '/bug01270.inc';
try { func1(); } catch (Exception $e) { }
try { func2(); } catch (Exception $e) { }
try { func3(); } catch (Exception $e) { }
$cc = xdebug_get_code_coverage();
ksort( $cc );
var_dump( array_slice( $cc, 1, 1 ) );
?>
--EXPECTF--
array(1) {
["%sbug01270.inc"]=>
array(10) {
[4]=>
int(1)
[5]=>
int(1)
[7]=>
int(1)
[13]=>
int(1)
[14]=>
int(1)
[16]=>
int(1)
[22]=>
int(1)
[23]=>
int(1)
[27]=>
int(1)
[33]=>
int(1)
}
}
@@ -0,0 +1,62 @@
--TEST--
Test for bug #1270: String parsing marked not covered (>= PHP 7.4, !opcache)
--SKIPIF--
<?php
require __DIR__ . '/utils.inc';
check_reqs('PHP >= 7.4; !opcache');
?>
--FILE--
<?php
xdebug_start_code_coverage( XDEBUG_CC_UNUSED | XDEBUG_CC_DEAD_CODE );
include dirname( __FILE__ ) . '/bug01270.inc';
try { func1(); } catch (Exception $e) { }
try { func2(); } catch (Exception $e) { }
try { func3(); } catch (Exception $e) { }
$cc = xdebug_get_code_coverage();
ksort( $cc );
var_dump( array_slice( $cc, 1, 1 ) );
?>
--EXPECTF--
array(1) {
["%sbug01270.inc"]=>
array(17) {
[4]=>
int(1)
[5]=>
int(1)
[6]=>
int(1)
[7]=>
int(1)
[9]=>
int(-2)
[13]=>
int(1)
[14]=>
int(1)
[15]=>
int(1)
[16]=>
int(1)
[18]=>
int(-2)
[22]=>
int(1)
[23]=>
int(1)
[25]=>
int(1)
[27]=>
int(1)
[31]=>
int(-2)
[33]=>
int(1)
[35]=>
int(-2)
}
}
@@ -1,5 +1,10 @@
--TEST--
Test for bug #1357: Function signature using variadics is reported as being not executed
Test for bug #1357: Function signature using variadics is reported as being not executed (< PHP 7.4)
--SKIPIF--
<?php
require __DIR__ . '/utils.inc';
check_reqs('PHP < 7.4');
?>
--FILE--
<?php
@@ -39,7 +44,7 @@ hiArray
[0] => hi
)
array(1) {
["%sbug01357.php"]=>
["%sbug01357-php70.php"]=>
array(12) {
[5]=>
int(1)
@@ -0,0 +1,70 @@
--TEST--
Test for bug #1357: Function signature using variadics is reported as being not executed (>= PHP 7.4)
--SKIPIF--
<?php
require __DIR__ . '/utils.inc';
check_reqs('PHP >= 7.4');
?>
--FILE--
<?php
xdebug_start_code_coverage(XDEBUG_CC_UNUSED | XDEBUG_CC_DEAD_CODE);
class A {
public function test(...$a) {
print_r($a);
}
public function works($a) {
echo $a;
}
}
function works(...$a) {
print_r($a);
}
(new A)->test('hi');
(new A)->works('hi');
works('hi');
xdebug_stop_code_coverage(false);
var_dump(xdebug_get_code_coverage());
?>
--EXPECTF--
Array
(
[0] => hi
)
hiArray
(
[0] => hi
)
array(1) {
["%sbug01357-php74.php"]=>
array(10) {
[7]=>
int(1)
[8]=>
int(1)
[11]=>
int(1)
[12]=>
int(1)
[16]=>
int(1)
[17]=>
int(1)
[19]=>
int(1)
[21]=>
int(1)
[23]=>
int(1)
[25]=>
int(1)
}
}
@@ -1,9 +1,9 @@
--TEST--
Test for bug #1386: Executable code not shown as executed/executable (!opcache)
Test for bug #1386: Executable code not shown as executed/executable (< PHP 7.4, !opcache)
--SKIPIF--
<?php
require __DIR__ . '/utils.inc';
check_reqs('!opcache');
check_reqs('PHP < 7.4; !opcache');
?>
--INI--
xdebug.default_enable=1
@@ -1,9 +1,9 @@
--TEST--
Test for bug #1386: Executable code not shown as executed/executable (>= PHP 7.1, opcache)
Test for bug #1386: Executable code not shown as executed/executable (>= PHP 7.1, < PHP 7.4, opcache)
--SKIPIF--
<?php
require __DIR__ . '/utils.inc';
check_reqs('PHP >= 7.1; opcache');
check_reqs('PHP >= 7.1,< 7.4; opcache');
?>
--INI--
xdebug.default_enable=1
@@ -0,0 +1,65 @@
--TEST--
Test for bug #1386: Executable code not shown as executed/executable (>= PHP 7.4, opcache)
--SKIPIF--
<?php
require __DIR__ . '/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 'bug01386-class2.inc';
include 'bug01386-class1.inc';
$Test1 = new TestClass();
$cc = xdebug_get_code_coverage();
ksort($cc);
var_dump(array_slice($cc, 0, 2));
xdebug_stop_code_coverage(false);
?>
--EXPECTF--
array(2) {
["%sbug01386-class1.inc"]=>
array(5) {
[3]=>
int(1)
[7]=>
int(-1)
[8]=>
int(-1)
[9]=>
int(-1)
[13]=>
int(1)
}
["%sbug01386-class2.inc"]=>
array(4) {
[7]=>
int(-1)
[8]=>
int(-1)
[9]=>
int(-1)
[13]=>
int(1)
}
}

0 comments on commit f0d91d4

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