1
0
Fork 0

Installer now provides full download path to the downloader

pull/19/head
everzet 2011-09-24 01:30:17 +03:00
parent 45cab9fe8c
commit 0a2f4e7e32
2 changed files with 21 additions and 6 deletions

View File

@ -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);
}
}

View File

@ -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())