diff --git a/Page/Service/DefaultPageService.php b/Page/Service/DefaultPageService.php index 6619b292a..57346b57a 100644 --- a/Page/Service/DefaultPageService.php +++ b/Page/Service/DefaultPageService.php @@ -73,9 +73,7 @@ protected function updateSeoPage(PageInterface $page) return; } - if ($page->getTitle()) { - $this->seoPage->setTitle($page->getTitle() ?: $page->getName()); - } + $this->seoPage->setTitle($page->getTitle() ?: $page->getName()); if ($page->getMetaDescription()) { $this->seoPage->addMeta('name', 'description', $page->getMetaDescription()); diff --git a/Tests/Page/Service/DefaultPageServiceTest.php b/Tests/Page/Service/DefaultPageServiceTest.php index 978cc8d2b..02b2ba82a 100644 --- a/Tests/Page/Service/DefaultPageServiceTest.php +++ b/Tests/Page/Service/DefaultPageServiceTest.php @@ -60,7 +60,7 @@ public function testExecute() // 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->any())->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'));