Ejemplo n.º 1
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);
    }
Ejemplo n.º 2
0
 public function setUp()
 {
     parent::setUp();
     $manager = Mockery::mock();
     $manager->shouldReceive('persist')->andReturn($manager);
     $manager->shouldReceive('flush')->andReturn($manager);
     $this->tested = new EmployeeService($manager);
 }
 public function setUp()
 {
     parent::setUp();
     $profiler = $this->mockProfiler();
     $twigEnvironment = $this->mockTwigEnvironment();
     $templates = array('data_collector.foo' => array('foo', 'FooBundle:Collector:foo'), 'data_collector.bar' => array('bar', 'FooBundle:Collector:bar'), 'data_collector.baz' => array('baz', 'FooBundle:Collector:baz'));
     $this->templateManager = new TemplateManager($profiler, $twigEnvironment, $templates);
 }
 protected function setUp()
 {
     parent::setUp();
     $this->flatten = $this->getMock('Symfony\\Component\\HttpKernel\\Exception\\FlattenException');
     $this->flatten->expects($this->once())->method('getStatusCode')->will($this->returnValue(404));
     $this->controller = new ExceptionController();
     $this->kernel = $this->getMock('Symfony\\Component\\HttpKernel\\KernelInterface');
     $this->container = $this->getContainer();
 }
Ejemplo n.º 5
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);
 }
 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);
 }