public static function setupContainer(ContainerInterface $container) { $container->setShared('coverage.filter', function () { return new \PHP_CodeCoverage_Filter(); }); $container->setShared('coverage', function ($c) { $filter = $c->get('coverage.filter'); return new \PHP_CodeCoverage(null, $filter); }); $container->setShared('coverage.session', function () { $runner = new CodeCoverageSession(); return new $runner(); }); $container->setShared('dispatcher.listeners.coverage', function ($c) { return $c->get('coverage.session'); }); }
function let(ContainerInterface $container, OutputInterface $output, PhpGuard $phpGuard, Inspector $inspector) { $container->get('ui.output')->willReturn($output); $container->get('phpguard')->willReturn($phpGuard); $container->get('phpunit.inspector')->willReturn($inspector); $container->setShared('phpunit.inspector', Argument::any())->willReturn(); $logger = new Logger('PhpUnit'); $this->setLogger($logger); $this->setContainer($container); }
function it_should_configure_inspector(ContainerInterface $container, Runner $runner) { $this->beConstructedWith(); /*$container->get('runner') ->shouldBeCalled() ->willReturn($runner) ; $runner->findExecutable('behat-phpguard') ->shouldBeCalled() ->willReturn('some') ;*/ $container->setShared('behat.inspector', Argument::any())->shouldBeCalled(); $this->configure(); }
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); }
function it_should_configure_inspector_when_application_initialized(ContainerInterface $container) { $container->setShared('phpspec.inspector', Argument::any())->shouldBeCalled(); $this->configure(); }
public function setupContainer(ContainerInterface $container) { $container->set('ui.application', $this); $container->setShared('ui.shell', function ($c) { $shell = new Shell($c); return $shell; }); $phpGuard = new PhpGuard(); $phpGuard->setContainer($container); $phpGuard->setupServices($container); $phpGuard->setupCommands($container); $phpGuard->setupListeners($container); $container->set('phpguard', $phpGuard); $this->setDispatcher($container->get('dispatcher')); $this->container = $container; }
public function setupServices(ContainerInterface $container) { $container->setShared('config', function () { return new Processor(); }); $container->setShared('dispatcher', function ($c) { $dispatcher = new EventDispatcher(); array_map(array($dispatcher, 'addSubscriber'), $c->getByPrefix('dispatcher.listeners')); return $dispatcher; }); $container->setShared('logger.handler', function ($c) { $format = "%start_tag%[%datetime%][%channel%][%level_name%] %message% %context% %extra% %end_tag%\n"; $formatter = new ConsoleFormatter($format); $handler = new ConsoleHandler(null, true); $handler->setFormatter($formatter); return $handler; }); $container->setShared('logger', function ($c) { $logger = new Logger('Main'); $logger->pushHandler($c->get('logger.handler')); return $logger; }); $container->setShared('listen.listener', function ($c) { $listener = Listen::to(getcwd()); $options = $c->get('phpguard')->getOptions(); foreach ($options['ignores'] as $ignored) { $listener->ignores($ignored); } $phpguard = $c->get('phpguard'); $listener->latency($options['latency']); $listener->callback(array($phpguard, 'listen')); return $listener; }); $container->setShared('listen.adapter', function () { $adapter = Listen::getDefaultAdapter(); return $adapter; }); $container->setShared('locator', function () { $locator = new Locator(); return $locator; }); $container->setShared('dispatcher.listeners.locator', function ($c) { return $c->get('locator'); }); $container->setShared('runner.logger', function ($c) { $logger = new Logger('Runner'); $logger->pushHandler($c->get('logger.handler')); return $logger; }); $container->setShared('runner', function () { return new Runner(); }); $container->setShared('filesystem', function () { return new Filesystem(); }); CodeCoverageSession::setupContainer($container); }