Merge pull request #8363 from sincilite/feature/error-reporting-for-missing-path

Improve error reporting for missing path in Repository Path
main
Jordi Boggiano 5 years ago committed by GitHub
commit 18dad48fa6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -125,7 +125,13 @@ class PathRepository extends ArrayRepository implements ConfigurableRepositoryIn
{
parent::initialize();
foreach ($this->getUrlMatches() as $url) {
$urlMatches = $this->getUrlMatches();
if (empty($urlMatches)) {
throw new \RuntimeException('The `url` supplied for the path (' . $this->url . ') repository does not exist');
}
foreach ($urlMatches as $url) {
$path = realpath($url) . DIRECTORY_SEPARATOR;
$composerFilePath = $path.'composer.json';

@ -19,6 +19,22 @@ use Composer\Test\TestCase;
class PathRepositoryTest extends TestCase
{
/**
* @expectedException RuntimeException
*/
public function testLoadPackageFromFileSystemWithIncorrectPath()
{
$ioInterface = $this->getMockBuilder('Composer\IO\IOInterface')
->getMock();
$config = new \Composer\Config();
$repositoryUrl = implode(DIRECTORY_SEPARATOR, array(__DIR__, 'Fixtures', 'path', 'missing'));
$repository = new PathRepository(array('url' => $repositoryUrl), $ioInterface, $config);
$repository->getPackages();
}
public function testLoadPackageFromFileSystemWithVersion()
{
$ioInterface = $this->getMockBuilder('Composer\IO\IOInterface')

Loading…
Cancel
Save