/** * @param string[] $arguments The command arguments (without the name of the script itself) * @throws \Exception * @return int The exit value */ public function execute(array $arguments) { $configFile = null; $runConfig = []; $name = null; foreach ($arguments as $a) { $key = substr($a, 0, 2); $value = substr($a, 2); if ($key == '-l') { $runConfig['listen'][] = $value; } else { if ($key == '-c') { $argConfig = json_decode($value, true); if ($argConfig) { $runConfig = array_merge_recursive($runConfig, $argConfig); } else { $configFile = $value; } } else { $name = TestName::parse($a); } } } $configuration = $this->reader->read($configFile, $runConfig); $runner = $configuration->getRunner(); return $runner->run($name) ? 0 : 1; }
function parseEscapedStrings(Assert $assert) { $name = TestName::parse('foo$:$:bar$:$:::$:b$$az'); $assert($name->part(0), 'foo::bar::'); $assert($name->part(1), ':b$az'); }