Skip to content

Commit

Permalink
Update/split tests for PHP 7.3
Browse files Browse the repository at this point in the history
  • Loading branch information
derickr committed Dec 15, 2018
1 parent 82f0bb0 commit d1835bc
Show file tree
Hide file tree
Showing 19 changed files with 328 additions and 93 deletions.
9 changes: 6 additions & 3 deletions tests/bug00213-php71-opcache.phpt
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
--TEST--
Test for bug #213: Dead code analysis doesn't take catches for throws into account (>= PHP 7.1, opcache)
Test for bug #213: Dead code analysis doesn't take catches for throws into account (>= PHP 7.1, < PHP 7.3, opcache)
--SKIPIF--
<?php if (!version_compare(phpversion(), "7.1", '>=')) echo "skip >= PHP 7.1 needed\n"; ?>
<?php if (!extension_loaded('zend opcache')) echo "skip opcache required\n"; ?>
<?php
if (version_compare(phpversion(), "7.1", '<')) echo "skip >= PHP 7.1, < PHP 7.3 needed\n";
if (version_compare(phpversion(), "7.3", '>=')) echo "skip >= PHP 7.1, < PHP 7.3 needed\n";
if (!extension_loaded('zend opcache')) echo "skip opcache required\n";
?>
--INI--
xdebug.default_enable=1
xdebug.auto_trace=0
Expand Down
45 changes: 45 additions & 0 deletions tests/bug00213-php73-opcache.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
--TEST--
Test for bug #213: Dead code analysis doesn't take catches for throws into account (>= PHP 7.3, opcache)
--SKIPIF--
<?php
if (version_compare(phpversion(), "7.3", '<')) echo "skip >= PHP 7.3 needed\n";
if (!extension_loaded('zend opcache')) echo "skip opcache required\n";
?>
--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.extended_info=1
xdebug.coverage_enable=1
xdebug.overload_var_dump=0
--FILE--
<?php
xdebug_start_code_coverage( XDEBUG_CC_UNUSED | XDEBUG_CC_DEAD_CODE );
$file = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'bug00213.inc';
include $file;
$cc = xdebug_get_code_coverage();
xdebug_stop_code_coverage();
var_dump($cc[$file]);
?>
--EXPECT--
48
array(5) {
[5]=>
int(1)
[6]=>
int(-2)
[8]=>
int(1)
[12]=>
int(1)
[14]=>
int(1)
}
9 changes: 6 additions & 3 deletions tests/bug00334-php71-opcache.phpt
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
--TEST--
Test for bug #334: Code Coverage Regressions (>= PHP 7.1, opcache)
Test for bug #334: Code Coverage Regressions (>= PHP 7.1, < PHP 7.3, opcache)
--SKIPIF--
<?php if (!version_compare(phpversion(), "7.1", '>=')) echo "skip >= PHP 7.1 needed\n"; ?>
<?php if (!extension_loaded('zend opcache')) echo "skip opcache required\n"; ?>
<?php
if (version_compare(phpversion(), "7.1", '<')) echo "skip >= PHP 7.1, < PHP 7.3 needed\n";
if (version_compare(phpversion(), "7.3", '>=')) echo "skip >= PHP 7.1, < PHP 7.3 needed\n";
if (!extension_loaded('zend opcache')) echo "skip opcache required\n";
?>
--INI--
xdebug.default_enable=1
xdebug.dump_globals=0
Expand Down
44 changes: 44 additions & 0 deletions tests/bug00334-php73-opcache.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
--TEST--
Test for bug #334: Code Coverage Regressions (>= PHP 7.3, opcache)
--SKIPIF--
<?php
if (version_compare(phpversion(), "7.3", '<')) echo "skip >= PHP 7.3 needed\n";
if (!extension_loaded('zend opcache')) echo "skip opcache required\n";
?>
--INI--
xdebug.default_enable=1
xdebug.dump_globals=0
xdebug.show_mem_delta=0
xdebug.profiler_enable=0
xdebug.trace_format=0
xdebug.overload_var_dump=0
--FILE--
<?php
// Run me from the PHP CLI
xdebug_start_code_coverage(XDEBUG_CC_DEAD_CODE | XDEBUG_CC_UNUSED);
// MUST be both code coverage options to cause problems
include(dirname(__FILE__).'/bug00334.inc'); // File with problem in it.
$c = xdebug_get_code_coverage();
ksort($c);
var_dump($c);
xdebug_stop_code_coverage();
?>
--EXPECTF--
array(2) {
["%sbug00334-php73-opcache.php"]=>
array(2) {
[5]=>
int(1)
[6]=>
int(1)
}
["%sbug00334.inc"]=>
array(3) {
[5]=>
int(1)
[7]=>
int(-1)
[9]=>
int(1)
}
}
4 changes: 2 additions & 2 deletions tests/bug00756-php7.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ TRACE START [%d-%d-%d %d:%d:%d]
%w%f %w%d -> foo::bar() %sbug00756-php7.php:21
=> %r(\+\+self::bar|self::bar\+\+)%r %sbug00756-php7.php:9
%w%f %w%d -> foo->__construct() %sbug00756-php7.php:22
=> $this->foo++ %sbug00756-php7.php:14
=> %r(\$this->foo\+\+|\+\+\$this->foo)%r %sbug00756-php7.php:14
=> $f = class foo { public $foo = 1 } %sbug00756-php7.php:22
%w%f %w%d -> foo->__construct() %sbug00756-php7.php:23
=> $this->foo++ %sbug00756-php7.php:14
=> %r(\$this->foo\+\+|\+\+\$this->foo)%r %sbug00756-php7.php:14
%w%f %w%d -> xdebug_stop_trace() %sbug00756-php7.php:25
%w%f %w%d
TRACE END [%d-%d-%d %d:%d:%d]
Expand Down
9 changes: 6 additions & 3 deletions tests/bug01034-003-php71-opcache.phpt
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
--TEST--
Test for bug #1034: path coverage [3] (> PHP 7.1, opcache)
Test for bug #1034: path coverage [3] (> PHP 7.1, < PHP 7.3, opcache)
--SKIPIF--
<?php if (!version_compare(phpversion(), "7.1", '>')) echo "skip > PHP 7.1 needed\n"; ?>
<?php if (!extension_loaded('zend opcache')) echo "skip opcache required\n"; ?>
<?php
if (version_compare(phpversion(), "7.1", '<')) echo "skip >= PHP 7.1, < PHP 7.3 needed\n";
if (version_compare(phpversion(), "7.3", '>=')) echo "skip >= PHP 7.1, < PHP 7.3 needed\n";
if (!extension_loaded('zend opcache')) echo "skip opcache required\n";
?>
--FILE--
<?php
include 'dump-branch-coverage.inc';
Expand Down
61 changes: 0 additions & 61 deletions tests/bug01034-003-php73-opcache.phpt

This file was deleted.

9 changes: 6 additions & 3 deletions tests/bug01210-php71-opcache.phpt
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
--TEST--
Test for bug #1210: Coverage of sending arguments to a method (>= PHP 7.1, opcache)
Test for bug #1210: Coverage of sending arguments to a method (>= PHP 7.1, < PHP 7.3, opcache)
--SKIPIF--
<?php if (!version_compare(phpversion(), "7.1", '>')) echo "skip > PHP 7.1 needed\n"; ?>
<?php if (!extension_loaded('zend opcache')) echo "skip opcache required\n"; ?>
<?php
if (version_compare(phpversion(), "7.1", '<')) echo "skip >= PHP 7.1, < PHP 7.3 needed\n";
if (version_compare(phpversion(), "7.3", '>=')) echo "skip >= PHP 7.1, < PHP 7.3 needed\n";
if (!extension_loaded('zend opcache')) echo "skip opcache required\n";
?>
--FILE--
<?php
include 'dump-branch-coverage.inc';
Expand Down
9 changes: 6 additions & 3 deletions tests/bug01270-php72-opcache.phpt
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
--TEST--
Test for bug #1270: String parsing marked not covered (>= PHP 7.2)
Test for bug #1270: String parsing marked not covered (>= PHP 7.2, < PHP 7.3, opcache)
--SKIPIF--
<?php if (!version_compare(phpversion(), "7.2", '>=')) echo "skip >= PHP 7.2 needed\n"; ?>
<?php if (!extension_loaded('zend opcache')) echo "skip opcache required\n"; ?>
<?php
if (version_compare(phpversion(), "7.2", '<')) echo "skip >= PHP 7.2, < PHP 7.3 needed\n";
if (version_compare(phpversion(), "7.3", '>=')) echo "skip >= PHP 7.2, < PHP 7.3 needed\n";
if (!extension_loaded('zend opcache')) echo "skip opcache required\n";
?>
--FILE--
<?php
xdebug_start_code_coverage( XDEBUG_CC_UNUSED | XDEBUG_CC_DEAD_CODE );
Expand Down
68 changes: 68 additions & 0 deletions tests/bug01270-php73-opcache.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
--TEST--
Test for bug #1270: String parsing marked not covered (>= PHP 7.3, opcache)
--SKIPIF--
<?php
if (version_compare(phpversion(), "7.3", '<')) echo "skip >= PHP 7.3 needed\n";
if (!extension_loaded('zend opcache')) echo "skip opcache required\n";
?>
--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(20) {
[2]=>
int(1)
[4]=>
int(1)
[5]=>
int(1)
[6]=>
int(-1)
[7]=>
int(1)
[9]=>
int(-2)
[11]=>
int(1)
[13]=>
int(1)
[14]=>
int(1)
[15]=>
int(-1)
[16]=>
int(1)
[18]=>
int(-2)
[20]=>
int(1)
[22]=>
int(1)
[23]=>
int(1)
[25]=>
int(-1)
[27]=>
int(1)
[31]=>
int(-2)
[33]=>
int(1)
[35]=>
int(-2)
}
}
5 changes: 3 additions & 2 deletions tests/bug01386-php71-opcache.phpt
Original file line number Diff line number Diff line change
@@ -1,8 +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.3, opcache)
--SKIPIF--
<?php
if (!version_compare(phpversion(), "7.1", '>=')) echo "skip >= PHP 7.1 needed\n";
if (version_compare(phpversion(), "7.1", '<')) echo "skip >= PHP 7.1, < PHP 7.3 needed\n";
if (version_compare(phpversion(), "7.3", '>=')) echo "skip >= PHP 7.1, < PHP 7.3 needed\n";
if (!extension_loaded('zend opcache')) echo "skip opcache required\n";
?>
--INI--
Expand Down
72 changes: 72 additions & 0 deletions tests/bug01386-php73-opcache.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
--TEST--
Test for bug #1386: Executable code not shown as executed/executable (>= PHP 7.3, opcache)
--SKIPIF--
<?php
if (version_compare(phpversion(), "7.3", '<')) echo "skip >= PHP 7.3, < PHP 7.3 needed\n";
if (!extension_loaded('zend opcache')) echo "skip opcache required\n";
?>
--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.extended_info=1
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(6) {
[3]=>
int(1)
[7]=>
int(-1)
[8]=>
int(-1)
[9]=>
int(-1)
[10]=>
int(-2)
[13]=>
int(1)
}
["%sbug01386-class2.inc"]=>
array(6) {
[3]=>
int(1)
[7]=>
int(-1)
[8]=>
int(-1)
[9]=>
int(-1)
[10]=>
int(-2)
[13]=>
int(1)
}
}

Loading

0 comments on commit d1835bc

Please sign in to comment.