public function testGetContainer() { $page = new Page(); $block1 = $this->getMock('Sonata\\PageBundle\\Model\\BlockInterface'); $block1->expects($this->once())->method('getType')->will($this->returnValue('sonata.page.block.action')); $block2 = $this->getMock('Sonata\\PageBundle\\Model\\BlockInterface'); $block2->expects($this->once())->method('getType')->will($this->returnValue('sonata.page.block.container')); $block2->expects($this->once())->method('getSetting')->will($this->returnValue('bar')); $block3 = $this->getMock('Sonata\\PageBundle\\Model\\BlockInterface'); $block3->expects($this->once())->method('getType')->will($this->returnValue('sonata.page.block.container')); $block3->expects($this->once())->method('getSetting')->will($this->returnValue('gotcha')); $page->addBlocks($block1); $page->addBlocks($block2); $page->addBlocks($block3); $this->assertEquals($block3, $page->getContainerByName('gotcha')); }