/** * @param \Venne\Packages\IPackage $package * @param \Venne\Packages\DependencyResolver\Problem $problem */ public function testInstall(IPackage $package, Problem $problem = null) { $installedPackages =& $this->installedPackages; $packages =& $this->packages; foreach ($package->getRequire() as $name) { if (!isset($installedPackages[$name])) { if ($problem && isset($packages[$name])) { $solver = $this->createSolver(); $solver->testInstall($packages[$name], $problem); $job = new Job(Job::ACTION_INSTALL, $packages[$name]); if (!$problem->hasSolution($job)) { $problem->addSolution($job); } $installedPackages[$name] = $packages[$name]; $tr = array($this->libsDir => '%libsDir%'); $this->packagesConfig[$name] = array(PackageManager::PACKAGE_STATUS => PackageManager::STATUS_INSTALLED, PackageManager::PACKAGE_PATH => str_replace(array_keys($tr), array_merge($tr), $package->getPath())); } else { throw new InvalidArgumentException(sprintf('Package \'%s\' depend on \'%s\', which was not found.', $package->getName(), $name)); } } } }