/**
  * {@inheritdoc}.
  */
 public function guessValues(UrlInformation $urlInformation, $object, $sitemap)
 {
     if ($urlInformation->getLabel()) {
         return;
     }
     $seoMetadata = $this->seoPresentation->getSeoMetadata($object);
     if ($seoMetadata->getTitle()) {
         $urlInformation->setLabel($seoMetadata->getTitle());
     }
 }
 /**
  * Transforms a single sitemap document into url information.
  *
  * A sitemap document is a document, which should be exposed on a sitemap.
  *
  * @param object $document
  *
  * @return UrlInformation
  */
 protected function computeUrlInformationFromSitemapDocument($document)
 {
     $urlInformation = new UrlInformation();
     $urlInformation->setLocation($this->router->generate($document, array(), true));
     $urlInformation->setChangeFrequency($this->defaultChanFrequency);
     if ($this->alternateLocaleProvider) {
         $collection = $this->alternateLocaleProvider->createForContent($document);
         $urlInformation->setAlternateLocales($collection->toArray());
     }
     $seoMetadata = $this->seoPresentation->getSeoMetadata($document);
     if (null !== $seoMetadata->getTitle()) {
         $urlInformation->setLabel($seoMetadata->getTitle());
         return $urlInformation;
     }
     return $urlInformation;
 }
 public function testCacheRefresh()
 {
     // promises
     $extractors = $this->getMockBuilder('Symfony\\Cmf\\Bundle\\SeoBundle\\Cache\\ExtractorCollection')->disableOriginalConstructor()->getMock();
     $extractors->expects($this->any())->method('isFresh')->will($this->returnValue(false));
     $extractors->expects($this->any())->method('getIterator')->will($this->returnValue(new \ArrayIterator()));
     $cache = $this->getMock('Symfony\\Cmf\\Bundle\\SeoBundle\\Cache\\CacheInterface');
     $cache->expects($this->any())->method('loadExtractorsFromCache')->will($this->returnValue($extractors));
     $seoPresentation = new SeoPresentation($this->pageService, $this->translator, $this->configValues, $cache);
     // predictions
     $cache->expects($this->once())->method('putExtractorsInCache');
     $seoPresentation->updateSeoPage($this->content);
     return array($seoPresentation, $cache, $extractors);
 }
 public function testLocaleMetaTag()
 {
     $seoPresentation = new SeoPresentation($this->pageService, $this->translator, $this->configValues, null, 'en');
     // predictions
     $this->pageService->expects($this->once())->method('addMeta')->with('http-equiv', 'language', 'en');
     // test
     $seoPresentation->updateSeoPage(new \stdClass());
 }