/** * gets svn info on the provided path from the remote repo * returns the info in a SimpleXMLExtended object, with the hierarchy: * * entry / * (attributes: kind, path, revision) * url * repository / * root * uuid * commit / * (attributes: revision) * author * date * * @param string $svnPath SVN path to retrieve (i.e. "tags/2011-03-30_00-00-00") * @throws SubversionToolsException * @return SimpleXMLExtended commit metadata */ public function getPathInfo($svnPath) { $this->_validateSvnConfig(); $user = escapeshellarg($this->svnUsername); $pw = escapeshellarg($this->svnPassword); $svnPath = trim($svnPath, '/'); $svn = "svn info --xml --username {$user} --password {$pw} {$this->svnRepository}/{$svnPath}"; $this->Logger->debug($svn); $rawPathInfo = trim(shell_exec($svn)); $this->Logger->debug($rawPathInfo); try { $parsedPathInfo = $this->SimpleXMLParser->parseXMLString($rawPathInfo); if (!isset($parsedPathInfo->entry)) { throw new Exception(); } } catch (Exception $e) { throw new SubversionToolsException('Path not found in repository!'); } return $parsedPathInfo; }
/** * @dataProvider getInvalidXmls * @expectedException \SimpleXMLParserException * * @param string $string */ public function testParseBadXMLString($string) { $doc = $this->parser->parseXMLString($string); }