Example #1
0
 private function parseWatchSection(PluginInterface $plugin, $definitions)
 {
     foreach ($definitions as $options) {
         $watcher = new Watcher($this->container);
         $watcher->setOptions($options);
         $plugin->addWatcher($watcher);
     }
 }
 function it_postLoad_should_configure_only_active_plugin(GenericEvent $event, ContainerInterface $container, PluginInterface $active, PluginInterface $inactive)
 {
     $container->getByPrefix('plugins')->shouldBeCalled()->willReturn(array($active, $inactive));
     $active->getTitle()->shouldBeCalled()->willReturn('Some');
     $active->isActive()->willReturn(true);
     $active->configure()->shouldBeCalled();
     $inactive->isActive()->willReturn(false);
     $inactive->configure()->shouldNotBeCalled();
     $this->postLoad($event);
 }
 function it_should_runAll_after_pass(Runner $runner, Process $process, ContainerInterface $container, PluginInterface $plugin)
 {
     $plugin->getOptions()->willReturn(array('cli' => '--some-options', 'all_after_pass' => true, 'keep_failed' => true, 'run_all' => array('cli' => 'run-all')));
     $this->setContainer($container);
     $results = array('succeed' => ResultEvent::createSucceed('Succeed'));
     Filesystem::create()->serialize($this->cacheFile, $results);
     $runner->run(Argument::any())->shouldBeCalled();
     $process->getExitCode()->shouldBeCalled()->willReturn(0);
     $results = $this->run(array('some_path'));
     $results = $results->getResults();
     $results->shouldHaveCount(2);
 }
 function it_should_run_all_after_pass(Runner $runner, Process $process, PluginInterface $plugin, ContainerInterface $container)
 {
     $plugin->getOptions()->willReturn(array('cli' => '--some-options', 'all_after_pass' => true, 'run_all_cli' => '--some-run-all'));
     $this->beConstructedWith();
     $this->setContainer($container);
     $event = ResultEvent::createSucceed('Success');
     Filesystem::create()->serialize($this->cacheFile, array('key' => $event));
     $process->getExitCode()->willReturn(0);
     $runner->run(Argument::any())->willReturn($process)->shouldBeCalled();
     $results = $this->run(array('some_path'))->getResults();
     $results->shouldHaveCount(2);
     $results->shouldHaveKey('all_after_pass');
 }
 function it_plugin_should_not_runAll_if_not_active(ContainerInterface $container, PluginInterface $active, PluginInterface $inactive, GenericEvent $event)
 {
     $event->getSubject()->willReturn($container);
     $event->getArgument('plugin')->willReturn(null);
     $event->addProcessEvent(Argument::any())->shouldBeCalled();
     $container->getByPrefix('plugins')->willReturn(array($active, $inactive));
     $container->has('active')->willReturn(true);
     $active->isActive()->shouldBeCalled()->willReturn(true);
     $active->runAll()->willReturn(new ProcessEvent($active->getWrappedObject(), array()));
     $active->getTitle()->willReturn('active');
     $container->has('inactive')->willReturn(true);
     $inactive->getName()->willReturn('inactive');
     $inactive->getTitle()->willReturn('Inactive');
     $inactive->isActive()->shouldBeCalled()->willReturn(false);
     $inactive->runAll(Argument::any())->shouldNotBeCalled();
     $this->runAllCommand($event);
 }