Installer now provides full download path to the downloader

main
everzet 13 years ago
parent 45cab9fe8c
commit 0a2f4e7e32

@ -108,7 +108,7 @@ class LibraryInstaller implements InstallerInterface
*/ */
public function install(PackageInterface $package) 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); $this->registry->registerPackage($package, $type);
} }
@ -127,7 +127,7 @@ class LibraryInstaller implements InstallerInterface
} }
$type = $this->registry->getRegisteredPackageInstallerType($initial); $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->unregisterPackage($initial);
$this->registry->registerPackage($target, $type); $this->registry->registerPackage($target, $type);
} }
@ -146,7 +146,7 @@ class LibraryInstaller implements InstallerInterface
} }
$type = $this->registry->getRegisteredPackageInstallerType($package); $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); $this->registry->unregisterPackage($package);
} }
} }

@ -110,10 +110,15 @@ class LibraryInstallerTest extends \PHPUnit_Framework_TestCase
$library = new LibraryInstaller($this->dir, $this->dm, $this->registry); $library = new LibraryInstaller($this->dir, $this->dm, $this->registry);
$package = $this->createPackageMock(); $package = $this->createPackageMock();
$package
->expects($this->once())
->method('getName')
->will($this->returnValue('some/package'));
$this->dm $this->dm
->expects($this->once()) ->expects($this->once())
->method('download') ->method('download')
->with($package, $this->dir) ->with($package, $this->dir.'/some/package')
->will($this->returnValue('source')); ->will($this->returnValue('source'));
$this->registry $this->registry
@ -130,6 +135,11 @@ class LibraryInstallerTest extends \PHPUnit_Framework_TestCase
$initial = $this->createPackageMock(); $initial = $this->createPackageMock();
$target = $this->createPackageMock(); $target = $this->createPackageMock();
$initial
->expects($this->once())
->method('getName')
->will($this->returnValue('package1'));
$this->registry $this->registry
->expects($this->exactly(2)) ->expects($this->exactly(2))
->method('isPackageRegistered') ->method('isPackageRegistered')
@ -145,7 +155,7 @@ class LibraryInstallerTest extends \PHPUnit_Framework_TestCase
$this->dm $this->dm
->expects($this->once()) ->expects($this->once())
->method('update') ->method('update')
->with($initial, $target, $this->dir, 'dist'); ->with($initial, $target, $this->dir.'/package1', 'dist');
$this->registry $this->registry
->expects($this->once()) ->expects($this->once())
@ -169,6 +179,11 @@ class LibraryInstallerTest extends \PHPUnit_Framework_TestCase
$library = new LibraryInstaller($this->dir, $this->dm, $this->registry); $library = new LibraryInstaller($this->dir, $this->dm, $this->registry);
$package = $this->createPackageMock(); $package = $this->createPackageMock();
$package
->expects($this->once())
->method('getName')
->will($this->returnValue('pkg'));
$this->registry $this->registry
->expects($this->exactly(2)) ->expects($this->exactly(2))
->method('isPackageRegistered') ->method('isPackageRegistered')
@ -184,7 +199,7 @@ class LibraryInstallerTest extends \PHPUnit_Framework_TestCase
$this->dm $this->dm
->expects($this->once()) ->expects($this->once())
->method('remove') ->method('remove')
->with($package, $this->dir, 'source'); ->with($package, $this->dir.'/pkg', 'source');
$this->registry $this->registry
->expects($this->once()) ->expects($this->once())

Loading…
Cancel
Save