public function getInstallPath(PackageInterface $package)
 {
     $path = PackageUtils::getPackageInstallPath($package, $this->composer);
     if (!empty($path)) {
         return $path;
     }
     /*
      * In case, the user didn't provide a custom path
      * use the default one, by calling the parent::getInstallPath function
      */
     return parent::getInstallPath($package);
 }
 public function testUpgradeWithSameClassName()
 {
     $this->repository->expects($this->exactly(3))->method('getPackages')->will($this->returnValue(array($this->packages[1])));
     $this->repository->expects($this->exactly(2))->method('hasPackage')->will($this->onConsecutiveCalls(true, false));
     $installer = new PluginInstaller($this->io, $this->composer);
     $this->pm->loadInstalledPlugins();
     $installer->update($this->repository, $this->packages[1], $this->packages[2]);
     $plugins = $this->pm->getPlugins();
     $this->assertEquals('installer-v3', $plugins[1]->version);
 }
 public function testRegisterPluginOnlyOneTime()
 {
     $this->repository->expects($this->exactly(2))->method('getPackages')->will($this->returnValue(array()));
     $installer = new PluginInstaller($this->io, $this->composer);
     $this->pm->loadInstalledPlugins();
     $installer->install($this->repository, $this->packages[0]);
     $installer->install($this->repository, clone $this->packages[0]);
     $plugins = $this->pm->getPlugins();
     $this->assertCount(1, $plugins);
     $this->assertEquals('installer-v1', $plugins[0]->version);
 }