Install every package in its own directory, fixes #73
parent
56fab04c93
commit
4904e76185
|
@ -123,10 +123,7 @@ class LibraryInstaller implements InstallerInterface
|
||||||
*/
|
*/
|
||||||
public function getInstallPath(PackageInterface $package)
|
public function getInstallPath(PackageInterface $package)
|
||||||
{
|
{
|
||||||
if (null === $package->getTargetDir()) {
|
$targetDir = $package->getTargetDir();
|
||||||
return ($this->directory ? $this->directory.'/' : '').$package->getName();
|
return ($this->directory ? $this->directory.'/' : '') . $package->getName() . ($targetDir ? '/'.$targetDir : '');
|
||||||
}
|
|
||||||
|
|
||||||
return ($this->directory ? $this->directory.'/' : '').$package->getTargetDir();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -160,6 +160,32 @@ class LibraryInstallerTest extends \PHPUnit_Framework_TestCase
|
||||||
$library->uninstall($package);
|
$library->uninstall($package);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testGetInstallPath()
|
||||||
|
{
|
||||||
|
$library = new LibraryInstaller($this->dir, $this->dm, $this->repository);
|
||||||
|
$package = $this->createPackageMock();
|
||||||
|
|
||||||
|
$package
|
||||||
|
->expects($this->once())
|
||||||
|
->method('getTargetDir')
|
||||||
|
->will($this->returnValue(null));
|
||||||
|
|
||||||
|
$this->assertEquals($this->dir.'/'.$package->getName(), $library->getInstallPath($package));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testGetInstallPathWithTargetDir()
|
||||||
|
{
|
||||||
|
$library = new LibraryInstaller($this->dir, $this->dm, $this->repository);
|
||||||
|
$package = $this->createPackageMock();
|
||||||
|
|
||||||
|
$package
|
||||||
|
->expects($this->once())
|
||||||
|
->method('getTargetDir')
|
||||||
|
->will($this->returnValue('Some/Namespace'));
|
||||||
|
|
||||||
|
$this->assertEquals($this->dir.'/'.$package->getName().'/Some/Namespace', $library->getInstallPath($package));
|
||||||
|
}
|
||||||
|
|
||||||
private function createPackageMock()
|
private function createPackageMock()
|
||||||
{
|
{
|
||||||
return $this->getMockBuilder('Composer\Package\MemoryPackage')
|
return $this->getMockBuilder('Composer\Package\MemoryPackage')
|
||||||
|
|
Loading…
Reference in New Issue