/**
  * Test the default page service execution.
  */
 public function testExecute()
 {
     // GIVEN
     // mock a http request
     $request = $this->getMock('Symfony\\Component\\HttpFoundation\\Request');
     // mock http response
     $response = $this->getMock('Symfony\\Component\\HttpFoundation\\Response');
     // mock a page instance
     $page = $this->getMock('Sonata\\PageBundle\\Model\\PageInterface');
     $page->expects($this->exactly(2))->method('getTitle')->will($this->returnValue('page title'));
     $page->expects($this->atLeastOnce())->method('getMetaDescription')->will($this->returnValue('page meta description'));
     $page->expects($this->atLeastOnce())->method('getMetaKeyword')->will($this->returnValue('page meta keywords'));
     $page->expects($this->once())->method('getTemplateCode')->will($this->returnValue('template code'));
     // mocked SeoPage should expect SEO values
     $this->seoPage->expects($this->once())->method('setTitle')->with($this->equalTo('page title'));
     $metaMapping = array(array('name', 'description', 'page meta description', true), array('name', 'keywords', 'page meta keywords', true), array('property', 'og:type', 'article', true));
     $this->seoPage->expects($this->exactly(3))->method('addMeta')->will($this->returnValueMap($metaMapping));
     $this->seoPage->expects($this->once())->method('addHtmlAttributes')->with($this->equalTo('prefix'), $this->equalTo('og: http://ogp.me/ns#'));
     // mocked template manager should render something
     $this->templateManager->expects($this->once())->method('renderResponse')->with($this->equalTo('template code'))->will($this->returnValue($response));
     // WHEN
     $this->service->execute($page, $request);
     // THEN
     // mock asserts
 }
 /**
  * Constructor
  *
  * @param string                    $name            Page service name
  * @param TemplateManagerInterface  $templateManager Template manager
  * @param SeoPageInterface          $seoPage         SEO page object
  */
 public function __construct($name, TemplateManagerInterface $templateManager, SeoPageInterface $seoPage = null, $seoPageTitle = null)
 {
     parent::__construct($name, $templateManager, $seoPage);
     $this->setSeoPageTitle($seoPageTitle);
 }