- Improved the parser for the legacy args option
- New tests for the legacy args option string - New Exception when no tests are executed
This commit is contained in:
parent
11f087a239
commit
00035a7d81
|
@ -96,13 +96,13 @@ class PhpUnitOptions
|
|||
$this->arguments = $rawArgs;
|
||||
} else {
|
||||
/*
|
||||
* Try to parse old argument in a single string
|
||||
* Try to parse old arguments in a single string
|
||||
*/
|
||||
preg_match_all('/--([a-z\-]+)\s?("?[^-]{2}[^"]*"?)?/', (string)$rawArgs, $argsMatch);
|
||||
preg_match_all('@--([a-z\-]+)([\s=]+)?[\'"]?((?!--)[-\w/.,\\\]+)?[\'"]?@', (string)$rawArgs, $argsMatch);
|
||||
|
||||
if (!empty($argsMatch) && sizeof($argsMatch) > 2) {
|
||||
foreach ($argsMatch[1] as $index => $argName) {
|
||||
$this->addArgument($argName, $argsMatch[2][$index]);
|
||||
$this->addArgument($argName, $argsMatch[3][$index]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,6 +48,9 @@ class PhpUnitResult
|
|||
public function parse()
|
||||
{
|
||||
$rawResults = file_get_contents($this->outputFile);
|
||||
if (empty($rawResults)) {
|
||||
throw new \Exception('No test executed.');
|
||||
}
|
||||
if ($rawResults[0] == '{') {
|
||||
$fixedJson = '[' . str_replace('}{', '},{', $rawResults) . ']';
|
||||
$events = json_decode($fixedJson, true);
|
||||
|
|
|
@ -61,6 +61,39 @@ class PhpUnitOptionsTest extends \PHPUnit_Framework_TestCase
|
|||
'coverage-html' => '/path/to/coverage1/',
|
||||
),
|
||||
),
|
||||
array(
|
||||
array(
|
||||
'config' => array('tests/phpunit.xml'),
|
||||
'args' => "--testsuite=unit --bootstrap=vendor/autoload.php",
|
||||
),
|
||||
array(
|
||||
'testsuite' => 'unit',
|
||||
'bootstrap' => 'vendor/autoload.php',
|
||||
'configuration' => array('tests/phpunit.xml'),
|
||||
),
|
||||
),
|
||||
array(
|
||||
array(
|
||||
'config' => array('tests/phpunit.xml'),
|
||||
'args' => "--testsuite='unit' --bootstrap 'vendor/autoload.php'",
|
||||
),
|
||||
array(
|
||||
'testsuite' => 'unit',
|
||||
'bootstrap' => 'vendor/autoload.php',
|
||||
'configuration' => array('tests/phpunit.xml'),
|
||||
),
|
||||
),
|
||||
array(
|
||||
array(
|
||||
'config' => array('tests/phpunit.xml'),
|
||||
'args' => '--testsuite="unit" --bootstrap "vendor/autoload.php"',
|
||||
),
|
||||
array(
|
||||
'testsuite' => 'unit',
|
||||
'bootstrap' => 'vendor/autoload.php',
|
||||
'configuration' => array('tests/phpunit.xml'),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue