[FrameworkBundle] fixed the discovery of the PHPUnit configuration file when using aggregate options like in -vc app/ (closes #7562)

This commit is contained in:
Fabien Potencier 2013-04-05 08:39:48 +02:00
parent d65788b3c8
commit 375ded4227

View File

@ -82,19 +82,19 @@ abstract class WebTestCase extends \PHPUnit_Framework_TestCase
} }
/** /**
* Finds the value of configuration flag from cli * Finds the value of the CLI configuration option.
* *
* PHPUnit will use the last configuration argument on the command line, so this only returns * PHPUnit will use the last configuration argument on the command line, so this only returns
* the last configuration argument * the last configuration argument.
* *
* @return string The value of the phpunit cli configuration option * @return string The value of the PHPUnit cli configuration option
*/ */
private static function getPhpUnitCliConfigArgument() private static function getPhpUnitCliConfigArgument()
{ {
$dir = null; $dir = null;
$reversedArgs = array_reverse($_SERVER['argv']); $reversedArgs = array_reverse($_SERVER['argv']);
foreach ($reversedArgs as $argIndex => $testArg) { foreach ($reversedArgs as $argIndex => $testArg) {
if ($testArg === '-c' || $testArg === '--configuration') { if (preg_match('/^-[^ \-]*c$/', $testArg) || $testArg === '--configuration') {
$dir = realpath($reversedArgs[$argIndex - 1]); $dir = realpath($reversedArgs[$argIndex - 1]);
break; break;
} elseif (strpos($testArg, '--configuration=') === 0) { } elseif (strpos($testArg, '--configuration=') === 0) {