function let(ContainerInterface $container, OutputInterface $output, Logger $logger, Process $process, ProcessBuilder $builder) { $builder->getProcess()->willReturn($process); $process->getCommandLine()->willReturn('some_command'); $process->getExitCode()->willReturn(0); $process->getExitCodeText()->willReturn('exit_code_text'); $container->get('runner.logger')->willReturn($logger); $container->get('ui.output')->willReturn($output); $container->getParameter('runner.tty', false)->willReturn(false); $container->getParameter('runner.default_dirs')->willReturn(array()); $this->setContainer($container); }
function let(ContainerInterface $container, Logger $logger, Locator $locator, Inspector $inspector, Application $application) { $container->get('locator')->willReturn($locator); $container->get('phpspec.inspector')->willReturn($inspector); $container->get('ui.application')->willReturn($application); $container->getParameter('filter.tags', Argument::any())->willReturn(array()); $container->getParameter('phpspec.suites', Argument::any())->willReturn(array()); // initialize default options $this->setOptions(array()); $container->get('logger')->willReturn($logger); $this->setContainer($container); $this->setLogger($logger); }
function it_should_initialize_application(GenericEvent $event, EventDispatcherInterface $dispatcher, ContainerInterface $container) { $dispatcher->dispatch(ConfigEvents::LOAD, Argument::any())->shouldBeCalled(); $container->getParameter('app.initialized', false)->shouldBeCalled()->willReturn(false); $container->setParameter('app.initialized', true)->shouldBeCalled(); $this->initialize($event, 'initialize', $dispatcher); }
/** * @codeCoverageIgnore */ public function exitApplication() { $exitCode = $this->container->getParameter('application.exit_code', 0); $type = ResultEvent::$maps[$exitCode]; $this->container->get('logger')->addCommon('Application exit with code: <highlight>' . $exitCode . ' - ' . $type . '</highlight>'); $this->container->get('ui.output')->writeln(''); $this->container->get('logger')->addCommon(PhpGuard::EXIT_MESSAGE); $this->container->get('ui.output')->writeln(''); exit($exitCode); }
function it_should_reload_when_configuration_changed(ContainerInterface $container, ChangeSetEvent $event, EventDispatcherInterface $dispatcher, ConsoleHandler $handler, Logger $logger) { $container->getParameter('config.file', Argument::any())->shouldBeCalled()->willReturn('phpguard.yml.dist'); $container->get('logger.handler')->willReturn($handler); $container->get('logger')->willReturn($logger); $event->getFiles()->willReturn(array('phpguard.yml.dist')); $dispatcher->dispatch(ConfigEvents::RELOAD, Argument::any())->shouldBeCalled(); $dispatcher->dispatch(ApplicationEvents::preEvaluate, Argument::any())->shouldBeCalled(); $dispatcher->dispatch(ApplicationEvents::evaluate, Argument::any())->shouldBeCalled(); $dispatcher->dispatch(ApplicationEvents::postEvaluate, Argument::any())->shouldBeCalled(); $this->listen($event); }
function let(ContainerInterface $container, PluginInterface $plugin, EventDispatcherInterface $dispatcher, Shell $shell, PhpGuard $phpGuard, OutputInterface $output, Logger $logger, ConsoleHandler $handler) { $container->getByPrefix('plugins')->willReturn(array($plugin)); $container->get('dispatcher')->willReturn($dispatcher); $container->get('ui.shell')->willReturn($shell); $container->get('ui.output')->willReturn($output); $container->get('phpguard')->willReturn($phpGuard); $container->get('logger')->willReturn($logger); $container->get('logger.handler')->willReturn($handler); $container->getParameter('config.file')->willReturn('config_file'); $container->setParameter(Argument::cetera())->willReturn(true); $plugin->isActive()->willReturn(true); $plugin->getName()->willReturn('some'); $this->setContainer($container); }
function it_should_reload_configuration(GenericEvent $event, ContainerInterface $container, EventDispatcherInterface $dispatcher, Processor $processor) { $configFile = getcwd() . '/phpguard.yml.dist'; $container->get('config')->shouldBeCalled()->willReturn($processor); $container->getParameter('config.file')->shouldBeCalled()->willReturn($configFile); $dispatcher->dispatch(ConfigEvents::PRELOAD, $event)->shouldBeCalled(); $processor->compileFile($configFile)->shouldBeCalled(); $dispatcher->dispatch(ConfigEvents::POSTLOAD, $event)->shouldBeCalled(); $this->reload($event, ConfigEvents::LOAD, $dispatcher); }
function it_should_not_print_report_if_session_has_empty_results(ContainerInterface $container) { $container->getParameter('session.results', Argument::any())->willReturn(array()); $this->process(); }
function its_getMatchedFiles_returns_false_if_tag_is_not_matched(EvaluateEvent $event, Watcher $watcher, ContainerInterface $container) { $tags = array('foo'); $container->getParameter('filter.tags', array())->shouldBeCalled()->willReturn($tags); $watcher->hasTags($tags)->shouldBeCalled()->willReturn(false); $watcher->matchFile(__FILE__)->shouldNotBeCalled(); $watcher->getOptions()->willReturn(array('tags' => $tags)); $event->getFiles()->willReturn(array(__FILE__)); $this->getMatchedFiles($event); }