Fix tests and edge case
parent
94076c0bb9
commit
d94e638461
|
@ -175,7 +175,8 @@ class PluginManager
|
|||
$localRepo = $this->composer->getRepositoryManager()->getLocalRepository();
|
||||
$globalRepo = $this->globalComposer ? $this->globalComposer->getRepositoryManager()->getLocalRepository() : null;
|
||||
|
||||
$rootPackageRepo = new RootPackageRepository($this->composer->getPackage());
|
||||
$rootPackage = clone $this->composer->getPackage();
|
||||
$rootPackageRepo = new RootPackageRepository($rootPackage);
|
||||
$installedRepo = new InstalledRepository(array($localRepo, $rootPackageRepo));
|
||||
if ($globalRepo) {
|
||||
$installedRepo->addRepository($globalRepo);
|
||||
|
@ -187,7 +188,7 @@ class PluginManager
|
|||
$generator = $this->composer->getAutoloadGenerator();
|
||||
$autoloads = array();
|
||||
foreach ($autoloadPackages as $autoloadPackage) {
|
||||
if ($autoloadPackage === $this->composer->getPackage()) {
|
||||
if ($autoloadPackage === $rootPackage) {
|
||||
$downloadPath = '';
|
||||
} else {
|
||||
$downloadPath = $this->getInstallPath($autoloadPackage, $globalRepo && $globalRepo->hasPackage($autoloadPackage));
|
||||
|
@ -195,7 +196,7 @@ class PluginManager
|
|||
$autoloads[] = array($autoloadPackage, $downloadPath);
|
||||
}
|
||||
|
||||
$map = $generator->parseAutoloads($autoloads, $this->composer->getPackage());
|
||||
$map = $generator->parseAutoloads($autoloads, $rootPackage);
|
||||
$classLoader = $generator->createLoader($map);
|
||||
$classLoader->register();
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@ use Composer\Installer\PluginInstaller;
|
|||
use Composer\Package\CompletePackage;
|
||||
use Composer\Package\Loader\JsonLoader;
|
||||
use Composer\Package\Loader\ArrayLoader;
|
||||
use Composer\Package\RootPackage;
|
||||
use Composer\Plugin\PluginManager;
|
||||
use Composer\IO\BufferIO;
|
||||
use Composer\EventDispatcher\EventDispatcher;
|
||||
|
@ -111,6 +112,7 @@ class PluginInstallerTest extends TestCase
|
|||
$this->composer->setInstallationManager($im);
|
||||
$this->composer->setAutoloadGenerator($this->autoloadGenerator);
|
||||
$this->composer->setEventDispatcher(new EventDispatcher($this->composer, $this->io));
|
||||
$this->composer->setPackage(new RootPackage('dummy/root', '1.0.0.0', '1.0.0'));
|
||||
|
||||
$this->pm = new PluginManager($this->io, $this->composer);
|
||||
$this->composer->setPluginManager($this->pm);
|
||||
|
|
Loading…
Reference in New Issue