1
0
Fork 0

Refactor InstallationManagerMock

pull/635/merge
Jordi Boggiano 2012-04-29 17:27:37 +02:00
parent 2dffa612a3
commit bd50ad32f0
2 changed files with 6 additions and 15 deletions

View File

@ -33,7 +33,7 @@ class InstallationManager
{
private $installers = array();
private $cache = array();
protected $vendorPath;
private $vendorPath;
/**
* Creates an instance of InstallationManager
@ -197,14 +197,14 @@ class InstallationManager
return getcwd().DIRECTORY_SEPARATOR.$this->vendorPath;
}
protected function notifyInstall(PackageInterface $package)
private function notifyInstall(PackageInterface $package)
{
if ($package->getRepository() instanceof NotifiableRepositoryInterface) {
$package->getRepository()->notifyInstall($package);
}
}
protected function antiAlias(PackageInterface $package)
private function antiAlias(PackageInterface $package)
{
if ($package instanceof AliasPackage) {
$alias = $package;

View File

@ -24,28 +24,19 @@ class InstallationManagerMock extends InstallationManager
private $updated = array();
private $uninstalled = array();
public function __construct($vendorDir = 'vendor')
{
$this->vendorPath = $vendorDir;
}
public function install(RepositoryInterface $repo, InstallOperation $operation)
{
$package = $this->antiAlias($operation->getPackage());
$this->installed[] = $package;
$this->installed[] = $operation->getPackage();
}
public function update(RepositoryInterface $repo, UpdateOperation $operation)
{
$initial = $this->antiAlias($operation->getInitialPackage());
$target = $this->antiAlias($operation->getTargetPackage());
$this->updated[] = $target;
$this->updated[] = array($operation->getInitialPackage(), $operation->getTargetPackage());
}
public function uninstall(RepositoryInterface $repo, UninstallOperation $operation)
{
$package = $this->antiAlias($operation->getPackage());
$this->uninstalled[] = $package;
$this->uninstalled[] = $operation->getPackage();
}
public function getInstalledPackages()