Merge pull request #8363 from sincilite/feature/error-reporting-for-missing-path
Improve error reporting for missing path in Repository Pathpull/8390/head
commit
18dad48fa6
|
@ -125,7 +125,13 @@ class PathRepository extends ArrayRepository implements ConfigurableRepositoryIn
|
||||||
{
|
{
|
||||||
parent::initialize();
|
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;
|
$path = realpath($url) . DIRECTORY_SEPARATOR;
|
||||||
$composerFilePath = $path.'composer.json';
|
$composerFilePath = $path.'composer.json';
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,22 @@ use Composer\Test\TestCase;
|
||||||
|
|
||||||
class PathRepositoryTest extends 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()
|
public function testLoadPackageFromFileSystemWithVersion()
|
||||||
{
|
{
|
||||||
$ioInterface = $this->getMockBuilder('Composer\IO\IOInterface')
|
$ioInterface = $this->getMockBuilder('Composer\IO\IOInterface')
|
||||||
|
|
Loading…
Reference in New Issue