Skip to content
Permalink
Browse files

Add PHP 7.4 specific tests for bug00757b

  • Loading branch information...
jasny authored and derickr committed Jun 7, 2019
1 parent a0b82a7 commit 9bb2e0a9e84dae8abe75046cd32e1ebd15839a3c
@@ -0,0 +1,64 @@
--TEST--
Test for bug #757: XDEBUG_CC_UNUSED does not work with code outside a function (< PHP 7.2 || (< PHP 7.4 && !opcache))
--SKIPIF--
<?php
require __DIR__ . '/utils.inc';
if ( ! ( runtime_version("7.2", '<') || (runtime_version("7.4", '<') && !opcache_active() ) ) ) { echo "skip < PHP 7.2 || (< PHP 7.4 && !opcache loaded needed)\n"; };
?>
--INI--
xdebug.default_enable=1
xdebug.overload_var_dump=0
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
--FILE--
<?php
xdebug_start_code_coverage(XDEBUG_CC_UNUSED);
function f()
{
$x = 1;
if ($x) {
$y = 2;
} else {
$y = 3;
}
echo $y, "\n";
}
f();
$cc = xdebug_get_code_coverage();
xdebug_stop_code_coverage();
var_dump($cc[__FILE__]);
?>
--EXPECT--
2
array(9) {
[4]=>
int(1)
[6]=>
int(1)
[7]=>
int(1)
[8]=>
int(1)
[10]=>
int(-1)
[12]=>
int(1)
[13]=>
int(1)
[15]=>
int(1)
[17]=>
int(1)
}
@@ -0,0 +1,62 @@
--TEST--
Test for bug #757: XDEBUG_CC_UNUSED does not work with code outside a function (>= PHP 7.2 && < PHP 7.4 && opcache)
--SKIPIF--
<?php
require __DIR__ . '/utils.inc';
if ( ! ( runtime_version("7.2", '>=') && runtime_version("7.4", '<') && opcache_active() ) ) { echo "skip >= PHP 7.2 && < PHP 7.4 && opcache\n"; };
?>
--INI--
xdebug.default_enable=1
xdebug.overload_var_dump=0
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
--FILE--
<?php
xdebug_start_code_coverage(XDEBUG_CC_UNUSED);
function f()
{
$x = 1;
if ($x) {
$y = 2;
} else {
$y = 3;
}
echo $y, "\n";
}
f();
$cc = xdebug_get_code_coverage();
xdebug_stop_code_coverage();
var_dump($cc[__FILE__]);
?>
--EXPECT--
2
array(8) {
[4]=>
int(1)
[6]=>
int(1)
[7]=>
int(1)
[8]=>
int(1)
[12]=>
int(1)
[13]=>
int(1)
[15]=>
int(1)
[17]=>
int(1)
}
@@ -1,9 +1,9 @@
--TEST--
Test for bug #757: XDEBUG_CC_UNUSED does not work with code outside a function (< PHP 7.2 || !opcache)
Test for bug #757: XDEBUG_CC_UNUSED does not work with code outside a function (>= PHP 7.4 && opcache)
--SKIPIF--
<?php
require __DIR__ . '/utils.inc';
if ( ( runtime_version("7.2", '>=') && opcache_active())) { echo "skip < PHP 7.2 || !opcache loaded needed\n"; };
check_reqs('PHP >= 7.4; opcache');
?>
--INI--
xdebug.default_enable=1
@@ -42,17 +42,13 @@ var_dump($cc[__FILE__]);
?>
--EXPECT--
2
array(9) {
[4]=>
int(1)
array(7) {
[6]=>
int(1)
[7]=>
int(1)
[8]=>
int(1)
[10]=>
int(-1)
[12]=>
int(1)
[13]=>
@@ -1,9 +1,9 @@
--TEST--
Test for bug #757: XDEBUG_CC_UNUSED does not work with code outside a function (>= PHP 7.2 && opcache)
Test for bug #757: XDEBUG_CC_UNUSED does not work with code outside a function (>= PHP 7.4 && !opcache)
--SKIPIF--
<?php
require __DIR__ . '/utils.inc';
check_reqs('PHP >= 7.2; opcache');
check_reqs('PHP >= 7.4; !opcache');
?>
--INI--
xdebug.default_enable=1
@@ -43,14 +43,14 @@ var_dump($cc[__FILE__]);
--EXPECT--
2
array(8) {
[4]=>
int(1)
[6]=>
int(1)
[7]=>
int(1)
[8]=>
int(1)
[10]=>
int(-1)
[12]=>
int(1)
[13]=>

0 comments on commit 9bb2e0a

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