/** * @param \DOMDocument $xml * @return \DOMDocument */ protected function _addDefaultProcessors(\DOMDocument $xml) { $type = $xml->getElementsByTagName('type'); if (!$type->length) { return $xml; } // add default preprocessor before existing, common/<type> $preprocessors = $xml->getElementsByTagName(Processor::PRE_PROCESSORS); $websiteCommon = $xml->createElement('directory', 'common/' . $type->item(0)->textContent); $commonType = $xml->createElement('directory', $this->_path->getWebsite() . '/common'); if ($preprocessors->length) { $firstNode = $preprocessors->item(0)->firstChild; $preprocessors->item(0)->insertBefore($commonType, $firstNode); $preprocessors->item(0)->insertBefore($websiteCommon, $firstNode); } else { $element = $xml->createElement('preprocessors'); $element->appendChild($commonType); $element->appendChild($websiteCommon); $xml->appendChild($element); } return $xml; }
/** * @covers ::getGroup * @covers ::_processPath */ public function test_getWebsite_should_return_proper_value() { $paramPath = 'configuration/eset/prep/'; $path = new Path($paramPath, '/base/absolute', 'rootdir'); $this->assertEquals('eset', $path->getWebsite()); }