diff --git a/src/Composer/Installer/LibraryInstaller.php b/src/Composer/Installer/LibraryInstaller.php index 6b224fba7..f8b1313e9 100644 --- a/src/Composer/Installer/LibraryInstaller.php +++ b/src/Composer/Installer/LibraryInstaller.php @@ -108,7 +108,7 @@ class LibraryInstaller implements InstallerInterface */ public function install(PackageInterface $package) { - $type = $this->dm->download($package, $this->dir); + $type = $this->dm->download($package, $this->dir.'/'.$package->getName()); $this->registry->registerPackage($package, $type); } @@ -127,7 +127,7 @@ class LibraryInstaller implements InstallerInterface } $type = $this->registry->getRegisteredPackageInstallerType($initial); - $this->dm->update($initial, $target, $this->dir, $type); + $this->dm->update($initial, $target, $this->dir.'/'.$initial->getName(), $type); $this->registry->unregisterPackage($initial); $this->registry->registerPackage($target, $type); } @@ -146,7 +146,7 @@ class LibraryInstaller implements InstallerInterface } $type = $this->registry->getRegisteredPackageInstallerType($package); - $this->dm->remove($package, $this->dir, $type); + $this->dm->remove($package, $this->dir.'/'.$package->getName(), $type); $this->registry->unregisterPackage($package); } } diff --git a/tests/Composer/Test/Installer/LibraryInstallerTest.php b/tests/Composer/Test/Installer/LibraryInstallerTest.php index 61ffc8d41..93f3414f8 100644 --- a/tests/Composer/Test/Installer/LibraryInstallerTest.php +++ b/tests/Composer/Test/Installer/LibraryInstallerTest.php @@ -110,10 +110,15 @@ class LibraryInstallerTest extends \PHPUnit_Framework_TestCase $library = new LibraryInstaller($this->dir, $this->dm, $this->registry); $package = $this->createPackageMock(); + $package + ->expects($this->once()) + ->method('getName') + ->will($this->returnValue('some/package')); + $this->dm ->expects($this->once()) ->method('download') - ->with($package, $this->dir) + ->with($package, $this->dir.'/some/package') ->will($this->returnValue('source')); $this->registry @@ -130,6 +135,11 @@ class LibraryInstallerTest extends \PHPUnit_Framework_TestCase $initial = $this->createPackageMock(); $target = $this->createPackageMock(); + $initial + ->expects($this->once()) + ->method('getName') + ->will($this->returnValue('package1')); + $this->registry ->expects($this->exactly(2)) ->method('isPackageRegistered') @@ -145,7 +155,7 @@ class LibraryInstallerTest extends \PHPUnit_Framework_TestCase $this->dm ->expects($this->once()) ->method('update') - ->with($initial, $target, $this->dir, 'dist'); + ->with($initial, $target, $this->dir.'/package1', 'dist'); $this->registry ->expects($this->once()) @@ -169,6 +179,11 @@ class LibraryInstallerTest extends \PHPUnit_Framework_TestCase $library = new LibraryInstaller($this->dir, $this->dm, $this->registry); $package = $this->createPackageMock(); + $package + ->expects($this->once()) + ->method('getName') + ->will($this->returnValue('pkg')); + $this->registry ->expects($this->exactly(2)) ->method('isPackageRegistered') @@ -184,7 +199,7 @@ class LibraryInstallerTest extends \PHPUnit_Framework_TestCase $this->dm ->expects($this->once()) ->method('remove') - ->with($package, $this->dir, 'source'); + ->with($package, $this->dir.'/pkg', 'source'); $this->registry ->expects($this->once())