/** * Set up the test */ public function setUp() { $this->block = Phake::mock('OpenOrchestra\\ModelInterface\\Model\\ReadBlockInterface'); Phake::when($this->block)->getComponent()->thenReturn('component'); $this->cacheableManager = Phake::mock('OpenOrchestra\\DisplayBundle\\Manager\\CacheableManager'); $this->templating = Phake::mock('Symfony\\Component\\Templating\\EngineInterface'); $this->tagManager = Phake::mock('OpenOrchestra\\BaseBundle\\Manager\\TagManager'); Phake::when($this->tagManager)->formatBlockTypeTag(Phake::anyParameters())->thenReturn($this->blockComponentTag); $this->wrongStrategy = Phake::mock('OpenOrchestra\\DisplayBundle\\DisplayBlock\\DisplayBlockInterface'); Phake::when($this->wrongStrategy)->support(Phake::anyParameters())->thenReturn(false); Phake::when($this->wrongStrategy)->getName()->thenReturn('wrong'); $this->strategy = Phake::mock('OpenOrchestra\\DisplayBundle\\DisplayBlock\\DisplayBlockInterface'); Phake::when($this->strategy)->support(Phake::anyParameters())->thenReturn(true); Phake::when($this->strategy)->getName()->thenReturn('right'); $currentSiteManager = Phake::mock('OpenOrchestra\\DisplayBundle\\Manager\\SiteManager'); $this->eventDispatcher = Phake::mock('Symfony\\Component\\EventDispatcher\\EventDispatcherInterface'); $this->manager = new DisplayBlockManager($this->templating, $this->cacheableManager, $this->tagManager, $currentSiteManager, $this->eventDispatcher); $this->manager->addStrategy($this->wrongStrategy); $this->manager->addStrategy($this->strategy); }