Refactor InstallationManagerMock
parent
2dffa612a3
commit
bd50ad32f0
|
@ -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;
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Reference in New Issue