Discussion:
svn: /pear/pear-core/trunk/PEAR/ RunTest.php
Helgi Þormar Þorbjörnsson
2011-07-05 00:06:58 UTC
Permalink
dufuz Tue, 05 Jul 2011 00:06:58 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=312920

Log:
No trimming of lines when saving coverage lines as it can mess with expected output.

Changed paths:
U pear/pear-core/trunk/PEAR/RunTest.php

Modified: pear/pear-core/trunk/PEAR/RunTest.php
===================================================================
--- pear/pear-core/trunk/PEAR/RunTest.php 2011-07-04 23:38:09 UTC (rev 312919)
+++ pear/pear-core/trunk/PEAR/RunTest.php 2011-07-05 00:06:58 UTC (rev 312920)
@@ -389,8 +389,6 @@
$coverage_shutdown = 'coverage_shutdown';

for ($i = 0; $i < $numLines; $i++) {
- $lines[$i] = trim($lines[$i]);
-
if ($lines[$i] == '<?' || $lines[$i] == '<?php') {
unset($lines[$i]);
}
Helgi Þormar Þorbjörnsson
2011-07-05 00:52:26 UTC
Permalink
dufuz Tue, 05 Jul 2011 00:52:26 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=312921

Log:
Only unset <? amd <?php if they are on the first line as tests can be writing out actual PHP files with proper tags.
Cosmetics

Changed paths:
U pear/pear-core/trunk/PEAR/RunTest.php

Modified: pear/pear-core/trunk/PEAR/RunTest.php
===================================================================
--- pear/pear-core/trunk/PEAR/RunTest.php 2011-07-05 00:06:58 UTC (rev 312920)
+++ pear/pear-core/trunk/PEAR/RunTest.php 2011-07-05 00:52:26 UTC (rev 312921)
@@ -388,11 +388,14 @@
$namespace = '';
$coverage_shutdown = 'coverage_shutdown';

+ if (
+ substr($lines[0], 0, 2) == '<?' ||
+ substr($lines[0], 0, 5) == '<?php'
+ ) {
+ unset($lines[0]);
+ }
+
for ($i = 0; $i < $numLines; $i++) {
- if ($lines[$i] == '<?' || $lines[$i] == '<?php') {
- unset($lines[$i]);
- }
-
if (isset($lines[$i]) && substr($lines[$i], 0, 9) == 'namespace') {
$namespace = substr($lines[$i], 10, -1);
$coverage_shutdown = $namespace . '\\coverage_shutdown';
@@ -403,9 +406,9 @@
}
}

- $text .= "\n" . 'xdebug_stop_code_coverage();' .
+ $text .= "\n xdebug_stop_code_coverage();" .
"\n" . '} // end coverage_shutdown()' .
- "\n" . 'register_shutdown_function("' . $coverage_shutdown . '");';
+ "\n\n" . 'register_shutdown_function("' . $coverage_shutdown . '");';
$text .= "\n" . 'xdebug_start_code_coverage(XDEBUG_CC_UNUSED | XDEBUG_CC_DEAD_CODE);' . "\n";

$this->save_text($temp_file, "<?php\n" . $namespace . $text . "\n" . implode("\n", $lines));
Loading...