/** * @param $ctx * * @return mixed * @throws ConfigException */ private function runResolver($ctx) { $vars = array('basedir' => $ctx->getAttribute('basedir', dirname($this->file->getRealPath())), 'phpDox.home' => $this->homeDir->getPathname(), 'phpDox.file' => $this->file->getPathname(), 'phpDox.version' => $this->version->getVersion(), 'phpDox.project.name' => $ctx->getAttribute('name', 'unnamed'), 'phpDox.project.source' => $ctx->getAttribute('source', 'src'), 'phpDox.project.workdir' => $ctx->getAttribute('workdir', 'xml'), 'phpDox.php.version' => PHP_VERSION); $protected = array_keys($vars); foreach ($ctx->query('cfg:property|/cfg:phpdox/cfg:property') as $property) { /** @var $property \DOMElement */ $name = $property->getAttribute('name'); $line = $property->getLineNo(); if (in_array($name, $protected)) { throw new ConfigException("Cannot overwrite system property in line {$line}", ConfigException::OverrideNotAllowed); } if (isset($vars[$name])) { throw new ConfigException("Cannot overwrite existing property '{$name}' in line {$line}", ConfigException::OverrideNotAllowed); } $vars[$name] = $this->resolveValue($property->getAttribute('value'), $vars, $line); } foreach ($ctx->query('.//*[not(name()="property")]/@*|@*') as $attr) { $attr->nodeValue = $this->resolveValue($attr->nodeValue, $vars, $attr->getLineNo()); } return $ctx; }
/** * @todo Implement testDetect(). */ public function testDetectFail() { $this->assertFalse($this->object->detect('data/unit.false')); }
public function testGetAndSetMagicFilepath() { $path = '/foo/bar'; $this->object->setMagicFilepath($path); $this->assertEquals($path, $this->object->getMagicFilepath()); }