Exemplo n.º 1
0
 function let(ContainerInterface $container, Inspector $inspector, Runner $runner)
 {
     $container->get('behat.inspector')->willReturn($inspector);
     $container->setShared('behat.inspector', Argument::any())->willReturn();
     $container->has('behat.inspector')->willReturn(false);
     $container->get('runner')->willReturn($runner);
     $this->setContainer($container);
     $this->configure();
 }
Exemplo n.º 2
0
    function it_throws_when_plugin_not_exists(ContainerInterface $container)
    {
        $container->has('plugins.some')->willReturn(false);
        $text = <<<EOF
some:
    watch:
        - { pattern: "#^spec\\/.*\\.php" }
EOF;
        $this->shouldThrow('InvalidArgumentException')->duringCompile($text);
    }
Exemplo n.º 3
0
 private function loadPlugin(ContainerInterface $container, $class)
 {
     if (class_exists($class)) {
         $r = new \ReflectionClass($class);
         if (!$r->isAbstract()) {
             $plugin = new $class();
             $id = 'plugins.' . $plugin->getName();
             if (!$container->has($id)) {
                 $logger = new Logger($plugin->getTitle());
                 $logger->pushHandler($container->get('logger.handler'));
                 $plugin->setLogger($logger);
                 $plugin->setContainer($container);
                 $container->set($id, $plugin);
                 $container->get('dispatcher')->addSubscriber($plugin);
             }
         }
     }
 }
Exemplo n.º 4
0
 function it_should_check_file_with_linter_if_defined(ContainerInterface $container, LinterInterface $linter)
 {
     $container->has('linters.some')->shouldBeCalled()->willReturn(true);
     $container->get('linters.some')->willReturn($linter);
     $linter->getName()->shouldBeCalled()->willReturn('some');
     $linter->getTitle()->willReturn('SomeTitle');
     $this->setOptions(array('lint' => 'some', 'pattern' => 'some'));
     $linter->check(__FILE__)->shouldBeCalled()->willReturn(true);
     $this->lint(__FILE__)->shouldReturn(true);
 }
Exemplo n.º 5
0
 function let(ContainerInterface $container, Logger $logger)
 {
     $container->get('logger')->willReturn($logger);
     $container->has(Argument::any())->willReturn(true);
     $this->setContainer($container);
 }