Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fixed bug #879: Closing brace in trait-using class definitions is counted towards code coverage. #34

Closed
wants to merge 1 commit into from

1 participant

@derickr
Owner

No description provided.

@derickr derickr referenced this pull request from a commit
@derickr derickr Merged pull request #34 9da6d93
@derickr
Owner

Merged pull request #34

@derickr derickr closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 29, 2012
  1. @derickr

    Fixed bug #879: Closing brace in trait-using class definitions is cou…

    derickr authored
    …nted towards code coverage.
This page is out of date. Refresh to see the latest.
Showing with 70 additions and 0 deletions.
  1. +7 −0 tests/bug00879.inc
  2. +59 −0 tests/bug00879.phpt
  3. +4 −0 xdebug.c
View
7 tests/bug00879.inc
@@ -0,0 +1,7 @@
+<?php
+
+trait T {}
+
+class WithTrait {
+ use T;
+}
View
59 tests/bug00879.phpt
@@ -0,0 +1,59 @@
+--TEST--
+Test for bug #879: Closing brace in trait-using class definitions is counted towards code coverage. (PHP >= 5.4)
+--SKIPIF--
+<?php if (version_compare(phpversion(), "5.4", '<')) echo "skip >= PHP 5.4 needed\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);
+
+$file = realpath('./tests/bug00879.inc');
+include $file;
+
+new WithTrait;
+
+var_dump(xdebug_get_code_coverage());
+?>
+--EXPECTF--
+array(2) {
+ ["%sbug00879.inc"]=>
+ array(5) {
+ [3]=>
+ int(1)
+ [5]=>
+ int(1)
+ [6]=>
+ int(1)
+ [7]=>
+ int(1)
+ [8]=>
+ int(1)
+ }
+ ["%sbug00879.php"]=>
+ array(4) {
+ [5]=>
+ int(1)
+ [6]=>
+ int(1)
+ [8]=>
+ int(1)
+ [10]=>
+ int(1)
+ }
+}
View
4 xdebug.c
@@ -630,6 +630,10 @@ PHP_MINIT_FUNCTION(xdebug)
#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 3) || PHP_MAJOR_VERSION >= 6
XDEBUG_SET_OPCODE_OVERRIDE_COMMON(ZEND_DECLARE_LAMBDA_FUNCTION);
#endif
+#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 4)
+ XDEBUG_SET_OPCODE_OVERRIDE_COMMON(ZEND_ADD_TRAIT);
+ XDEBUG_SET_OPCODE_OVERRIDE_COMMON(ZEND_BIND_TRAITS);
+#endif
}
XDEBUG_SET_OPCODE_OVERRIDE_ASSIGN(include_or_eval, ZEND_INCLUDE_OR_EVAL);
Something went wrong with that request. Please try again.