protected function getXmlFileContent($suitesEntries, $testsPath, $previousConfig = null) { $template = <<<'XML' <phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.5/phpunit.xsd" backupGlobals="true" backupStaticAttributes="false" bootstrap="{{{bootstrapPath}}}" cacheTokens="false" colors="false" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" forceCoversAnnotation="false" mapTestClassNameToCoveredClassName="false" printerClass="PHPUnit_TextUI_ResultPrinter" processIsolation="false" stopOnError="false" stopOnFailure="false" stopOnIncomplete="false" stopOnSkipped="false" stopOnRisky="false" testSuiteLoaderClass="PHPUnit_Runner_StandardTestSuiteLoader" timeoutForSmallTests="1" timeoutForMediumTests="10" timeoutForLargeTests="60" verbose="false"> <testsuites> {{{testSuites}}} </testsuites> </phpunit> XML; if (is_a($previousConfig, 'SimpleXMLElement')) { /** @var \SimpleXMLElement $previousConfig */ $attrs = (array) $previousConfig->attributes(); $attrs = reset($attrs); if (!empty($attrs)) { $new = simplexml_load_string($template); $newAttrs = (array) $new->attributes(); $newAttrs = reset($newAttrs); $keep = array_keys(array_intersect_key($attrs, $newAttrs)); $attrs = array_merge($newAttrs, $attrs); array_walk($attrs, function ($value, $key) use(&$new, $keep) { if (in_array($key, $keep)) { $new->attributes()->{$key} = $value; } else { unset($new->attributes()->{$key}); } }); $template = $new->saveXML(); } } return $this->compileTemplate(['testSuites' => implode("\n", $suitesEntries), 'bootstrapPath' => $this->bootstrapFilePath($testsPath)], $template); }