/** * Returns source url for merge. * * @param string $wc_path Working copy path. * * @return string * @throws CommandException When source path is invalid. */ protected function getSourceUrl($wc_path) { $source_url = $this->io->getOption('source-url'); if ($source_url === null) { $source_url = $this->getSetting(self::SETTING_MERGE_SOURCE_URL); } elseif (!$this->repositoryConnector->isUrl($source_url)) { $wc_url = $this->repositoryConnector->getWorkingCopyUrl($wc_path); $source_url = $this->_urlResolver->resolve($wc_url, $source_url); } if (!$source_url) { $wc_url = $this->repositoryConnector->getWorkingCopyUrl($wc_path); $source_url = $this->_mergeSourceDetector->detect($wc_url); if ($source_url) { $this->setSetting(self::SETTING_MERGE_SOURCE_URL, $source_url); } } if (!$source_url) { $wc_url = $this->repositoryConnector->getWorkingCopyUrl($wc_path); $error_msg = 'Unable to guess "--source-url" option value. Please specify it manually.' . PHP_EOL; $error_msg .= 'Working Copy URL: ' . $wc_url . '.'; throw new CommandException($error_msg); } return $source_url; }
/** * @dataProvider resolveDataProvider */ public function testResolve($wc_url, $url_to_resolve, $resolved_url) { $this->connector->getProjectUrl($wc_url)->willReturn('svn://user@domain.com/path/to/project'); $this->assertEquals($resolved_url, $this->urlResolver->resolve($wc_url, $url_to_resolve)); }