significant change to how run-tests works - is it OK?
| From: | Greg Beaver | Date: | Sat, 27 Nov 2004 08:09:13 +0000 |
| Subject: | significant change to how run-tests works - is it OK? | ||
| Groups: | php.pear.qa | ||
| Request: | Send a blank email to pear-qa+get-2031@lists.php.net to get a copy of this message | ||
Hi,
I just encountered one problem with run-tests - it uses backticks to execute tests, like so:
$out =
$cmd;
This is great for almost all situations. Unfortunately, in very rare cases, it is also necessary to test for return values. For instance, the shell-test command returns 1 or 0 - this is the only way to test its output (by design).
Fortunately, by changing the code above to:
ob_start();
system($cmd, $return_value);
$out = ob_get_contents();
ob_end_clean();
it's possible to retrieve the return value and test based on it. Otherwise, I will have to somehow run a test-within-a-test, which would suck.
My question is: are there any situations that anyone knows of where system() just doesn't measure up to the flexibility of shell_exec()?
Greg