private function decorateService($serviceId, $options)
 {
     $method = $options['method'];
     $action = $options['action'];
     $argument = $options['argument'];
     $retryDuration = $options['retry_duration'];
     $retryCount = $options['retry_count'];
     $synchronizedServiceId = sprintf('%s.synchronized', $serviceId);
     $definition = $this->container->register($synchronizedServiceId, 'Skafandri\\SynchronizedBundle\\Service\\SynchronizedService');
     $definition->addArgument(new Reference(sprintf('%s.inner', $synchronizedServiceId)))->addArgument(new Reference('synchronized.driver'))->addArgument($method)->addArgument($action)->addArgument($argument)->addArgument($retryDuration)->addArgument($retryCount)->setPublic(false)->setDecoratedService($serviceId);
 }
Esempio n. 2
0
 protected function setUp()
 {
     parent::setUp();
     $this->kernel = $this->getMock('Symfony\\Component\\HttpKernel\\KernelInterface');
     $this->container = new ContainerBuilder();
     $this->container->register('router', $this->getMockClass('Symfony\\Component\\Routing\\RouterInterface'));
     $this->container->register('twig', 'Twig_Environment');
     $this->container->setParameter('kernel.bundles', array());
     $this->container->setParameter('kernel.cache_dir', __DIR__);
     $this->container->setParameter('kernel.debug', false);
     $this->container->setParameter('kernel.root_dir', __DIR__);
     $this->container->setParameter('profiler.class', array('Symfony\\Component\\HttpKernel\\Profiler\\Profiler'));
     $this->container->register('profiler', $this->getMockClass('Symfony\\Component\\HttpKernel\\Profiler\\Profiler'))->addArgument(new Definition($this->getMockClass('Symfony\\Component\\HttpKernel\\Profiler\\ProfilerStorageInterface')));
     $this->container->setParameter('data_collector.templates', array());
     $this->container->set('kernel', $this->kernel);
 }
Esempio n. 3
0
    protected function setUp()
    {
        parent::setUp();

        $this->kernel = $this->getMock('Symfony\\Component\\HttpKernel\\KernelInterface');

        $this->container = new ContainerBuilder();
        $this->container->addScope(new Scope('request'));
        $this->container->register('request', 'Symfony\\Component\\HttpFoundation\\Request')->setScope('request');
        $this->container->register('templating.helper.assets', $this->getMockClass('Symfony\\Component\\Templating\\Helper\\AssetsHelper'));
        $this->container->register('templating.helper.router', $this->getMockClass('Symfony\\Bundle\\FrameworkBundle\\Templating\\Helper\\RouterHelper'))
            ->addArgument(new Definition($this->getMockClass('Symfony\\Component\\Routing\\RouterInterface')));
        $this->container->register('twig', 'Twig_Environment');
        $this->container->register('templating.engine.twig', $this->getMockClass('Symfony\\Bundle\\TwigBundle\\TwigEngine'))
            ->addArgument(new Definition($this->getMockClass('Twig_Environment')))
            ->addArgument(new Definition($this->getMockClass('Symfony\\Component\\Templating\\TemplateNameParserInterface')))
            ->addArgument(new Definition($this->getMockClass('Symfony\Component\Config\FileLocatorInterface')))
            ->addArgument(new Definition($this->getMockClass('Symfony\\Bundle\\FrameworkBundle\\Templating\\GlobalVariables'), array(new Definition($this->getMockClass('Symfony\\Component\\DependencyInjection\\Container')))));
        $this->container->setParameter('kernel.bundles', array());
        $this->container->setParameter('kernel.cache_dir', __DIR__);
        $this->container->setParameter('kernel.debug', false);
        $this->container->setParameter('kernel.root_dir', __DIR__);
        $this->container->register('profiler', $this->getMockClass('Symfony\\Component\\HttpKernel\\Profiler\\Profiler'))
            ->addArgument(new Definition($this->getMockClass('Symfony\\Component\\HttpKernel\\Profiler\\ProfilerStorageInterface')));
        $this->container->setParameter('data_collector.templates', array());
        $this->container->set('kernel', $this->kernel);
    }
 protected function setUp()
 {
     parent::setUp();
     $this->kernel = $this->getMock('Symfony\\Component\\HttpKernel\\KernelInterface');
     $this->container = new ContainerBuilder();
     $this->container->addScope(new Scope('request'));
     $this->container->register('request', 'Symfony\\Component\\HttpFoundation\\Request')->setScope('request');
     $this->container->register('router', $this->getMockClass('Symfony\\Component\\Routing\\RouterInterface'));
     $this->container->register('templating.helper.assets', $this->getMockClass('Symfony\\Component\\Templating\\Helper\\AssetsHelper'));
     $this->container->register('templating.helper.router', $this->getMockClass('Symfony\\Bundle\\FrameworkBundle\\Templating\\Helper\\RouterHelper'))->addArgument(new Reference('router'));
     $this->container->register('twig_loader', 'Twig_Loader_Array')->addArgument(array());
     $this->container->register('twig', 'Twig_Environment')->addArgument(new Reference('twig_loader'));
     $this->container->setParameter('kernel.bundles', array());
     $this->container->setParameter('kernel.cache_dir', __DIR__);
     $this->container->setParameter('kernel.debug', false);
     $this->container->setParameter('kernel.root_dir', __DIR__);
     $this->container->setParameter('profiler.class', array('Symfony\\Component\\HttpKernel\\Profiler\\Profiler'));
     $this->container->register('profiler', $this->getMockClass('Symfony\\Component\\HttpKernel\\Profiler\\Profiler'))->addArgument(new Definition($this->getMockClass('Symfony\\Component\\HttpKernel\\Profiler\\ProfilerStorageInterface')));
     $this->container->setParameter('data_collector.templates', array());
     $this->container->set('kernel', $this->kernel);
 }
Esempio n. 5
0
 /**
  * Registers a service definition.
  *
  * Wrapper for ContainerBuilder::getAliases method.
  * This methods allows for simple registration of service definition
  * with a fluid interface.
  *
  * @param string $id The service identifier
  * @param string $class The service class
  */
 public function register($id, $class = null)
 {
     return parent::register($id, $class);
 }