/** * Merge autoload into a RootPackage * * @param RootPackage $root */ protected function mergeAutoload(RootPackage $root) { $autoload = $this->package->getAutoload(); if (empty($autoload)) { return; } $this->prependPath($this->path, $autoload); $root->setAutoload(array_merge_recursive($root->getAutoload(), $autoload)); }
/** * Test if installer-name was set * */ public function testGetInstallPath() { $package = new RootPackage('Authenticate', '1.0', '1.0'); $autoload = array('psr-4' => array('FOC\\Authenticate' => 'src')); $package->setAutoload($autoload); $package->setType('cakephp-plugin'); $composer = new Composer(); $rm = new RepositoryManager($this->getMock('Composer\\IO\\IOInterface'), $this->getMock('Composer\\Config')); $composer->setRepositoryManager($rm); $installer = new CakePHPInstaller($package, $composer); $this->setCakephpVersion($rm, '3.0.0'); $installer->getInstallPath($package, 'cakephp'); $extra = $package->getExtra(); $this->assertEquals('FOC/Authenticate', $extra['installer-name']); }
/** * @param RootPackage $root * @param CompletePackage $package * @param string $path */ protected function mergeAutoload(RootPackage $root, CompletePackage $package, $path) { $autoload = $package->getAutoload(); if (empty($autoload)) { return; } $packagePath = substr($path, 0, strrpos($path, '/') + 1); array_walk_recursive($autoload, function (&$path) use($packagePath) { $path = $packagePath . $path; }); $root->setAutoload(array_merge_recursive($root->getAutoload(), $autoload)); }
/** * Merge autoload into a RootPackage * * @param RootPackage $root */ protected function mergeAutoload(RootPackage $root) { $autoload = $this->package->getAutoload(); if (empty($autoload)) { return; } $root->setAutoload(array_merge_recursive($root->getAutoload(), $this->fixRelativePaths($autoload))); }