public function testGetter() { $composer = $this->getMock('Composer\\Composer'); $io = $this->getMock('Composer\\IO\\IOInterface'); $policy = $this->getMock('Composer\\DependencyResolver\\PolicyInterface'); $pool = $this->getMockBuilder('Composer\\DependencyResolver\\Pool')->disableOriginalConstructor()->getMock(); $installedRepo = $this->getMockBuilder('Composer\\Repository\\CompositeRepository')->disableOriginalConstructor()->getMock(); $request = $this->getMockBuilder('Composer\\DependencyResolver\\Request')->disableOriginalConstructor()->getMock(); $operations = array($this->getMock('Composer\\DependencyResolver\\Operation\\OperationInterface')); $event = new InstallerEvent('EVENT_NAME', $composer, $io, $policy, $pool, $installedRepo, $request, $operations); $this->assertSame('EVENT_NAME', $event->getName()); $this->assertInstanceOf('Composer\\Composer', $event->getComposer()); $this->assertInstanceOf('Composer\\IO\\IOInterface', $event->getIO()); $this->assertInstanceOf('Composer\\DependencyResolver\\PolicyInterface', $event->getPolicy()); $this->assertInstanceOf('Composer\\DependencyResolver\\Pool', $event->getPool()); $this->assertInstanceOf('Composer\\Repository\\CompositeRepository', $event->getInstalledRepo()); $this->assertInstanceOf('Composer\\DependencyResolver\\Request', $event->getRequest()); $this->assertCount(1, $event->getOperations()); }
/** * Handle an event callback for pre-dependency solving phase of an install * or update by adding any duplicate package dependencies found during * initial merge processing to the request that will be processed by the * dependency solver. * * @param InstallerEvent $event */ public function onDependencySolve(InstallerEvent $event) { $request = $event->getRequest(); foreach ($this->state->getDuplicateLinks('require') as $link) { $this->logger->info("Adding dependency <comment>{$link}</comment>"); $request->install($link->getTarget(), $link->getConstraint()); } if ($this->state->isDevMode()) { foreach ($this->state->getDuplicateLinks('require-dev') as $link) { $this->logger->info("Adding dev dependency <comment>{$link}</comment>"); $request->install($link->getTarget(), $link->getConstraint()); } } }
/** * Handle an event callback for pre-dependency solving phase of an install * or update by adding any duplicate package dependencies found during * initial merge processing to the request that will be processed by the * dependency solver. * * @param InstallerEvent $event */ public function onDependencySolve(InstallerEvent $event) { if (!$this->duplicateLinks) { return; } $request = $event->getRequest(); foreach ($this->duplicateLinks['require'] as $link) { $this->debug("Adding dependency <comment>{$link}</comment>"); $request->install($link->getTarget(), $link->getConstraint()); } if ($this->devMode) { foreach ($this->duplicateLinks['require-dev'] as $link) { $this->debug("Adding dev dependency <comment>{$link}</comment>"); $request->install($link->getTarget(), $link->getConstraint()); } } }
/** * Handle an event callback for pre-dependency solving phase of an install * or update by adding any duplicate package dependencies found during * initial merge processing to the request that will be processed by the * dependency solver. * * @param InstallerEvent $event */ public function onDependencySolve(InstallerEvent $event) { if (empty($this->duplicateLinks)) { // @codeCoverageIgnoreStart // We shouldn't really ever be able to get here as this event is // triggered inside Composer\Installer and should have been // preceded by a pre-install or pre-update event but better to // have an unneeded check than to break with some future change in // the event system. return; // @codeCoverageIgnoreEnd } $request = $event->getRequest(); foreach ($this->duplicateLinks['require'] as $link) { $this->debug("Adding dependency <comment>{$link}</comment>"); $request->install($link->getTarget(), $link->getConstraint()); } if ($this->devMode) { foreach ($this->duplicateLinks['require-dev'] as $link) { $this->debug("Adding dev dependency <comment>{$link}</comment>"); $request->install($link->getTarget(), $link->getConstraint()); } } }
/** * Handle an event callback for pre-dependency solving phase of an install * or update by adding any duplicate package dependencies found during * initial merge processing to the request that will be processed by the * dependency solver. * * @param InstallerEvent $event */ public function onDependencySolve(InstallerEvent $event) { $request = $event->getRequest(); foreach ($this->state->getDuplicateLinks('require') as $link) { $this->logger->info("Adding dependency <comment>{$link}</comment>"); $request->install($link->getTarget(), $link->getConstraint()); } // Issue #113: Check devMode of event rather than our global state. // Composer fires the PRE_DEPENDENCIES_SOLVING event twice for // `--no-dev` operations to decide which packages are dev only // requirements. if ($this->state->shouldMergeDev() && $event->isDevMode()) { foreach ($this->state->getDuplicateLinks('require-dev') as $link) { $this->logger->info("Adding dev dependency <comment>{$link}</comment>"); $request->install($link->getTarget(), $link->getConstraint()); } } }
/** * Handle an event callback for pre-dependency solving phase of an install * or update by adding any duplicate package dependencies found during * initial merge processing to the request that will be processed by the * dependency solver. * * @param \Composer\Installer\InstallerEvent $event */ public function onDependencySolve(InstallerEvent $event) { $request = $event->getRequest(); $this->installRequires($request, $this->state->getDuplicateLinks('require')); // Check devMode of event rather than our global state. // Composer fires the PRE_DEPENDENCIES_SOLVING event twice for `--no-dev` // operations to decide which packages are dev only requirements. if ($this->state->shouldMergeDev() && $event->isDevMode()) { $this->installRequires($request, $this->state->getDuplicateLinks('require-dev'), true); } }