Skip to content

Commit

Permalink
fix(test): exit code of lime test -- add proof of current behaviour
Browse files Browse the repository at this point in the history
  • Loading branch information
alquerci committed Apr 9, 2024
1 parent 998e779 commit 38e6200
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions lib/vendor/lime/lime.php
Original file line number Diff line number Diff line change
Expand Up @@ -952,8 +952,7 @@ function lime_shutdown()
);

ob_start();
// see http://trac.symfony-project.org/ticket/5437 for the explanation on the weird "cd" thing
passthru(sprintf('cd & %s %s 2>&1', escapeshellarg($this->php_cli), escapeshellarg($test_file)), $return);
$return = $this->executePhpFile($test_file);
ob_end_clean();
unlink($test_file);

Expand Down Expand Up @@ -1123,6 +1122,20 @@ public function get_failed_files()
{
return isset($this->stats['failed_files']) ? $this->stats['failed_files'] : array();
}

/**
* The command fails if the path to php interpreter contains spaces.
* The only workaround is adding a "nop" command call before the quoted command.
* The weird "cd &".
*
* see http://trac.symfony-project.org/ticket/5437
*/
public function executePhpFile(string $phpFile): int
{
passthru(sprintf('cd & %s %s 2>&1', escapeshellarg($this->php_cli), escapeshellarg($phpFile)), $return);

return $return;
}
}

class lime_coverage extends lime_registration
Expand Down Expand Up @@ -1186,8 +1199,7 @@ public function process($files)
EOF;
file_put_contents($tmp_file, $tmp);
ob_start();
// see http://trac.symfony-project.org/ticket/5437 for the explanation on the weird "cd" thing
passthru(sprintf('cd & %s %s 2>&1', escapeshellarg($this->harness->php_cli), escapeshellarg($tmp_file)), $return);
$return = $this->harness->executePhpFile($tmp_file);
$retval = ob_get_clean();

if (0 != $return) // test exited without success
Expand Down

0 comments on commit 38e6200

Please sign in to comment.