diff --git a/src/Composer/Repository/PearRepository.php b/src/Composer/Repository/PearRepository.php index b964bf08e..fb4b64736 100644 --- a/src/Composer/Repository/PearRepository.php +++ b/src/Composer/Repository/PearRepository.php @@ -163,6 +163,7 @@ class PearRepository extends ArrayRepository 'autoload' => array( 'classmap' => array(''), ), + 'include-path' => array('/'), ); try { @@ -305,6 +306,7 @@ class PearRepository extends ArrayRepository 'autoload' => array( 'classmap' => array(''), ), + 'include-path' => array('/'), ); $packageKeys = array('l' => 'license', 'd' => 'description'); foreach ($packageKeys as $pear => $composer) { diff --git a/tests/Composer/Test/Repository/PearRepositoryTest.php b/tests/Composer/Test/Repository/PearRepositoryTest.php index 4df45449d..7021c8615 100644 --- a/tests/Composer/Test/Repository/PearRepositoryTest.php +++ b/tests/Composer/Test/Repository/PearRepositoryTest.php @@ -12,7 +12,6 @@ namespace Composer\Repository; -use Composer\Repository\FilesystemRepository; use Composer\Test\TestCase; /** @@ -30,10 +29,34 @@ class PearRepositoryTest extends TestCase */ private $remoteFilesystem; + public function testComposerNonCompatibleRepositoryShouldSetIncludePath() + { + $url = 'pear.phpmd.org'; + $expectedPackages = array( + array('name' => 'pear-phpmd/PHP_PMD', 'version' => '1.3.3'), + ); + + $repoConfig = array( + 'url' => $url + ); + + $this->createRepository($repoConfig); + + foreach ($expectedPackages as $expectedPackage) { + $package = $this->repository->findPackage($expectedPackage['name'], $expectedPackage['version']); + $this->assertInstanceOf('Composer\Package\PackageInterface', + $package, + 'Expected package ' . $expectedPackage['name'] . ', version ' . $expectedPackage['version'] . + ' not found in pear channel ' . $url + ); + $this->assertSame(array('/'), $package->getIncludePaths()); + } + } + /** * @dataProvider repositoryDataProvider * @param string $url - * @param array $expectedPackages + * @param array $expectedPackages */ public function testRepositoryRead($url, array $expectedPackages) { @@ -126,4 +149,4 @@ class PearRepositoryTest extends TestCase $this->repository = null; $this->remoteFilesystem = null; } -} \ No newline at end of file +}