/**
  * test the container layout.
  */
 public function testLayout()
 {
     $templating = new FakeTemplating();
     $service = new ContainerBlockService('core.container', $templating);
     $block = new Block();
     $block->setName('block.name');
     $block->setType('core.container');
     // we manually perform the settings merge
     $blockContext = new BlockContext($block, array('code' => 'block.code', 'layout' => 'before{{ CONTENT }}after', 'class' => '', 'template' => 'SonataPageBundle:Block:block_container.html.twig'));
     $service->execute($blockContext);
     $this->assertInternalType('array', $templating->parameters['decorator']);
     $this->assertArrayHasKey('pre', $templating->parameters['decorator']);
     $this->assertArrayHasKey('post', $templating->parameters['decorator']);
     $this->assertEquals('before', $templating->parameters['decorator']['pre']);
     $this->assertEquals('after', $templating->parameters['decorator']['post']);
 }
 public function testService()
 {
     $templating = new FakeTemplating();
     $service = new ContainerBlockService('core.container', $templating);
     $block = new Block();
     $block->setType('core.container');
     $block->setSettings(array('name' => 'Symfony'));
     $formMapper = $this->getMock('Sonata\\AdminBundle\\Form\\FormMapper', array(), array(), '', false);
     $formMapper->expects($this->exactly(6))->method('add');
     $manager = $this->getMock('Sonata\\PageBundle\\CmsManager\\CmsManagerInterface');
     $service->buildCreateForm($manager, $formMapper, $block);
     $service->buildEditForm($manager, $formMapper, $block);
     $page = new Page();
     $service->execute($manager, $block, $page);
     $this->assertEquals('SonataPageBundle:Block:block_container.html.twig', $templating->view);
     $this->assertEquals('Symfony', $templating->parameters['container']->getSetting('name'));
     $this->assertInstanceOf('Sonata\\PageBundle\\Tests\\Model\\Page', $templating->parameters['page']);
     $this->assertInstanceOf('Sonata\\PageBundle\\Tests\\Model\\Block', $templating->parameters['container']);
 }