Exemplo n.º 1
0
 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);
 }
Exemplo n.º 2
0
 function it_should_find_executable(ContainerInterface $container)
 {
     $container->hasParameter($id = 'runner.default_dirs')->willReturn(false);
     $container->setParameter($id, Argument::any())->shouldBeCalled();
     $this->findExecutable('foo')->shouldReturn(false);
     $this->findExecutable('php')->shouldNotReturn(false);
     $this->findExecutable('phpspec')->shouldNotReturn(false);
 }
Exemplo n.º 3
0
 function it_should_run_for_paths(Runner $runner, Process $process, ContainerInterface $container)
 {
     $results = array('succeed' => ResultEvent::createSucceed('Succeed'), 'failed' => ResultEvent::createFailed('Failed'), 'broken' => ResultEvent::createBroken('Broken'));
     Filesystem::create()->serialize($this->cacheFile, $results);
     $runner->run(Argument::any())->shouldBeCalled();
     $process->getExitCode()->shouldBeCalled()->willReturn(1);
     $container->setParameter('application.exit_code', ResultEvent::FAILED)->shouldBeCalled();
     $results = $this->run(array('some_path'));
     $results->getResults()->shouldHaveCount(2);
 }
Exemplo n.º 4
0
 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 let(ContainerInterface $container, PluginInterface $plugin, AdapterInterface $adapter, Listener $listener, ConsoleHandler $handler, Logger $logger, GenericEvent $event, InputInterface $input)
 {
     if (is_null(static::$cwd)) {
         static::$cwd = getcwd();
     }
     Filesystem::create()->mkdir(static::$tmpDir);
     $container->getByPrefix('plugins')->willReturn(array($plugin));
     $container->getParameter(Argument::any(), Argument::any())->willReturn(null);
     $container->setParameter(Argument::any(), Argument::any())->willReturn(null);
     $container->get('listen.listener')->willReturn($listener);
     $container->get('listen.adapter')->willReturn($adapter);
     $container->get('logger.handler')->willReturn($handler);
     $container->get('logger')->willReturn($logger);
     $event->getContainer()->willReturn($container);
     $container->get('ui.input')->willReturn($input);
     $this->setContainer($container);
 }
Exemplo n.º 6
0
 function let(ContainerInterface $container, PHP_CodeCoverage_Filter $filter, PHP_CodeCoverage $coverage, OutputInterface $output, PhpGuard $phpGuard, HandlerInterface $handler)
 {
     if (is_null(static::$cwd)) {
         static::$cwd = getcwd();
     }
     Filesystem::create()->mkdir(static::$tmpDir);
     chdir(static::$tmpDir);
     $container->get('coverage.filter')->willReturn($filter);
     $container->get('coverage')->willReturn($coverage);
     $coverage->beADoubleOf('PHP_CodeCoverage', array($filter));
     $this->options = array('enabled' => true, 'output.html' => null, 'output.clover' => null, 'output.text' => null, 'whitelist' => array(), 'blacklist' => array(), 'whitelist_files' => array(), 'blacklist_files' => array());
     $container->get('ui.output')->willReturn($output);
     $container->get('phpguard')->willReturn($phpGuard);
     $container->get('logger.handler')->willReturn($handler);
     $container->setShared(Argument::any(), Argument::any())->willReturn();
     $container->getParameter('coverage.enabled', Argument::any())->willReturn(false);
     $container->setParameter(Argument::cetera())->willReturn();
     $phpGuard->getOptions()->willReturn(array('coverage' => $this->options));
     $this->setContainer($container);
     $this->setOptions($this->options);
 }
Exemplo n.º 7
0
 function its_runAll_should_set_application_exit_code_if_results_has_failed_or_broken(ContainerInterface $container)
 {
     $failed = ResultEvent::createFailed('Failed', array('file' => 'some_file'));
     $success = ResultEvent::createSucceed('Success');
     Filesystem::create()->serialize($this->cacheFile, array('failed' => $failed, 'success' => $success));
     $container->setParameter('application.exit_code', ResultEvent::FAILED)->shouldBeCalled();
     $this->runAll();
 }
Exemplo n.º 8
0
 public function renderException($e, $output)
 {
     parent::renderException($e, $output);
     //$this->container->get('ui.shell')->installReadlineCallback();
     $this->container->setParameter('application.exit_code', ResultEvent::ERROR);
 }
Exemplo n.º 9
0
 public static function createApplication()
 {
     $app = new TestApplication();
     static::$container = $app->getContainer();
     static::$container->setParameter('phpguard.use_tty', false);
 }