Refactor InstallationManagerMock
parent
2dffa612a3
commit
bd50ad32f0
|
@ -33,7 +33,7 @@ class InstallationManager
|
||||||
{
|
{
|
||||||
private $installers = array();
|
private $installers = array();
|
||||||
private $cache = array();
|
private $cache = array();
|
||||||
protected $vendorPath;
|
private $vendorPath;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates an instance of InstallationManager
|
* Creates an instance of InstallationManager
|
||||||
|
@ -197,14 +197,14 @@ class InstallationManager
|
||||||
return getcwd().DIRECTORY_SEPARATOR.$this->vendorPath;
|
return getcwd().DIRECTORY_SEPARATOR.$this->vendorPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function notifyInstall(PackageInterface $package)
|
private function notifyInstall(PackageInterface $package)
|
||||||
{
|
{
|
||||||
if ($package->getRepository() instanceof NotifiableRepositoryInterface) {
|
if ($package->getRepository() instanceof NotifiableRepositoryInterface) {
|
||||||
$package->getRepository()->notifyInstall($package);
|
$package->getRepository()->notifyInstall($package);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function antiAlias(PackageInterface $package)
|
private function antiAlias(PackageInterface $package)
|
||||||
{
|
{
|
||||||
if ($package instanceof AliasPackage) {
|
if ($package instanceof AliasPackage) {
|
||||||
$alias = $package;
|
$alias = $package;
|
||||||
|
|
|
@ -24,28 +24,19 @@ class InstallationManagerMock extends InstallationManager
|
||||||
private $updated = array();
|
private $updated = array();
|
||||||
private $uninstalled = array();
|
private $uninstalled = array();
|
||||||
|
|
||||||
public function __construct($vendorDir = 'vendor')
|
|
||||||
{
|
|
||||||
$this->vendorPath = $vendorDir;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function install(RepositoryInterface $repo, InstallOperation $operation)
|
public function install(RepositoryInterface $repo, InstallOperation $operation)
|
||||||
{
|
{
|
||||||
$package = $this->antiAlias($operation->getPackage());
|
$this->installed[] = $operation->getPackage();
|
||||||
$this->installed[] = $package;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function update(RepositoryInterface $repo, UpdateOperation $operation)
|
public function update(RepositoryInterface $repo, UpdateOperation $operation)
|
||||||
{
|
{
|
||||||
$initial = $this->antiAlias($operation->getInitialPackage());
|
$this->updated[] = array($operation->getInitialPackage(), $operation->getTargetPackage());
|
||||||
$target = $this->antiAlias($operation->getTargetPackage());
|
|
||||||
$this->updated[] = $target;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function uninstall(RepositoryInterface $repo, UninstallOperation $operation)
|
public function uninstall(RepositoryInterface $repo, UninstallOperation $operation)
|
||||||
{
|
{
|
||||||
$package = $this->antiAlias($operation->getPackage());
|
$this->uninstalled[] = $operation->getPackage();
|
||||||
$this->uninstalled[] = $package;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getInstalledPackages()
|
public function getInstalledPackages()
|
||||||
|
|
Loading…
Reference in New Issue