/** * setup a basic scenario to avoid long test setup */ public function setUp() { $this->renderer1 = $this->getMock('\\Sonata\\BlockBundle\\Exception\\Renderer\\RendererInterface'); $this->renderer2 = $this->getMock('\\Sonata\\BlockBundle\\Exception\\Renderer\\RendererInterface'); $this->filter1 = $this->getMock('\\Sonata\\BlockBundle\\Exception\\Filter\\FilterInterface'); $this->filter2 = $this->getMock('\\Sonata\\BlockBundle\\Exception\\Filter\\FilterInterface'); // setup a mock container which contains our mock renderers and filters $this->container = $this->getMockContainer(array('service.renderer1' => $this->renderer1, 'service.renderer2' => $this->renderer2, 'service.filter1' => $this->filter1, 'service.filter2' => $this->filter2)); // setup 2 mock renderers $this->renderers = array(); $this->renderers['renderer1'] = 'service.renderer1'; $this->renderers['renderer2'] = 'service.renderer2'; // setup 2 mock filters $this->filters = array(); $this->filters['filter1'] = 'service.filter1'; $this->filters['filter2'] = 'service.filter2'; // setup a specific filter and renderer for "type1" blocks $this->blockFilters = array('block.type1' => 'filter2'); $this->blockRenderers = array('block.type1' => 'renderer2'); // create test object $this->manager = new StrategyManager($this->container, $this->filters, $this->renderers, $this->blockFilters, $this->blockRenderers); // setup default filters and renderers in manager $this->manager->setDefaultFilter('filter1'); $this->manager->setDefaultRenderer('renderer1'); }