protected function tearDown() { parent::tearDown(); $this->container = null; $this->kernel = null; }
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(); }
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\\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->set('kernel', $this->kernel); }