private function mergeFiles($directory, Finder $finder, $noSuffix)
    {
        $outXml = new fDOMDocument;
        $outXml->formatOutput = true;

        $outTestSuites = $outXml->createElement('testsuites');
        $outXml->appendChild($outTestSuites);

        $outTestSuite = $outXml->createElement('testsuite');
        $outTestSuites->appendChild($outTestSuite);

        $tests = 0;
        $assertions = 0;
        $failures = 0;
        $errors = 0;
        $time = 0;

        /** @var SplFileInfo $file */
        foreach ($finder as $file) {
            if ($this->isFileEmpty($file)) {
                continue;
            }

            $inXml = $this->loadFile($file->getRealpath());
            foreach ($inXml->query('//testsuites/testsuite') as $inElement) {

				if (!$noSuffix) {
					$inName = $inElement->getAttribute('name');
					$outName = $inName;
					$suffix = 2;
					while ($outTestSuite->query('//testsuite[@name="' . $outName . '"]')->length !== 0) {
						$outName = $inName . '_' . $suffix;
						$suffix++;
					}
				}

                $outElement = $outXml->importNode($inElement, true);
				if (!$noSuffix) {
					$outElement->setAttribute('name', $outName);
				}
                $outTestSuite->appendChild($outElement);

                $tests += $inElement->getAttribute('tests');
                $assertions += $inElement->getAttribute('assertions');
                $failures += $inElement->getAttribute('failures');
                $errors += $inElement->getAttribute('errors');
                $time += $inElement->getAttribute('time');
            }
        }

        $outTestSuite->setAttribute('name', $directory);
        $outTestSuite->setAttribute('tests', $tests);
        $outTestSuite->setAttribute('assertions', $assertions);
        $outTestSuite->setAttribute('failures', $failures);
        $outTestSuite->setAttribute('errors', $errors);
        $outTestSuite->setAttribute('time', $time);

        return $outXml;
    }
private function mergeFiles($directory, Finder $finder, $noSuffix)
    {
        $outXml = new fDOMDocument;
        $outXml->formatOutput = true;

        $outTestSuites = $outXml->createElement('testsuites');
        $outXml->appendChild($outTestSuites);

        $outTestSuite = $outXml->createElement('testsuite');
        $outTestSuites->appendChild($outTestSuite);

        $tests = 0;
        $assertions = 0;
        $failures = 0;
        $errors = 0;
        $time = 0;

        /** @var SplFileInfo $file */
        foreach ($finder as $file) {
            if ($this->isFileEmpty($file)) {
                continue;
            }

            $inXml = $this->loadFile($file->getRealpath());
            foreach ($inXml->query('//testsuites/testsuite') as $inElement) {

				if (!$noSuffix) {
					$inName = $inElement->getAttribute('name');
					$outName = $inName;
					$suffix = 2;
					while ($outTestSuite->query('//testsuite[@name="' . $outName . '"]')->length !== 0) {
						$outName = $inName . '_' . $suffix;
						$suffix++;
					}
				}

                $outElement = $outXml->importNode($inElement, true);
				if (!$noSuffix) {
					$outElement->setAttribute('name', $outName);
				}
                $outTestSuite->appendChild($outElement);

                $tests += $inElement->getAttribute('tests');
                $assertions += $inElement->getAttribute('assertions');
                $failures += $inElement->getAttribute('failures');
                $errors += $inElement->getAttribute('errors');
                $time += $inElement->getAttribute('time');
            }
        }

        $outTestSuite->setAttribute('name', $directory);
        $outTestSuite->setAttribute('tests', $tests);
        $outTestSuite->setAttribute('assertions', $assertions);
        $outTestSuite->setAttribute('failures', $failures);
        $outTestSuite->setAttribute('errors', $errors);
        $outTestSuite->setAttribute('time', $time);

        return $outXml;
    }
private function mergeFiles ( $ directory , Finder $ finder , $ noSuffix ) { $ outXml = new fDOMDocument ; $ outXml -> formatOutput = true ; $ outTestSuites = $ outXml -> createElement ( 'testsuites' ) ; $ outXml -> appendChild ( $ outTestSuites ) ; $ outTestSuite = $ outXml -> createElement ( 'testsuite' ) ; $ outTestSuites -> appendChild ( $ outTestSuite ) ; $ tests = 0 ; $ assertions = 0 ; $ failures = 0 ; $ errors = 0 ; $ time = 0 ; /** @var SplFileInfo $file */ foreach ( $ finder as $ file ) { if ( $ this -> isFileEmpty ( $ file ) ) { continue ; } $ inXml = $ this -> loadFile ( $ file -> getRealpath ( ) ) ; foreach ( $ inXml -> query ( '//testsuites/testsuite' ) as $ inElement ) { if ( ! $ noSuffix ) { $ inName = $ inElement -> getAttribute ( 'name' ) ; $ outName = $ inName ; $ suffix = 2 ; while ( $ outTestSuite -> query ( '//testsuite[@name="' . $ outName . '"]' ) -> length !== 0 ) { $ outName = $ inName . '_' . $ suffix ; $ suffix ++ ; } } $ outElement = $ outXml -> importNode ( $ inElement , true ) ; if ( ! $ noSuffix ) { $ outElement -> setAttribute ( 'name' , $ outName ) ; } $ outTestSuite -> appendChild ( $ outElement ) ; $ tests += $ inElement -> getAttribute ( 'tests' ) ; $ assertions += $ inElement -> getAttribute ( 'assertions' ) ; $ failures += $ inElement -> getAttribute ( 'failures' ) ; $ errors += $ inElement -> getAttribute ( 'errors' ) ; $ time += $ inElement -> getAttribute ( 'time' ) ; } } $ outTestSuite -> setAttribute ( 'name' , $ directory ) ; $ outTestSuite -> setAttribute ( 'tests' , $ tests ) ; $ outTestSuite -> setAttribute ( 'assertions' , $ assertions ) ; $ outTestSuite -> setAttribute ( 'failures' , $ failures ) ; $ outTestSuite -> setAttribute ( 'errors' , $ errors ) ; $ outTestSuite -> setAttribute ( 'time' , $ time ) ; return $ outXml ; }
Merge all files.

@param string $directory
@param Finder $finder
@param bool $noSuffix

@return fDOMDocument
Merge all files .