예제 #1
0
 public function testGetTitleTemplatesShouldReturnEmptyArrayIfTemplatesDoNotExist()
 {
     $routeName = 'test_route';
     $repo = $this->getMockBuilder('Doctrine\\ORM\\EntityRepository')->disableOriginalConstructor()->getMock();
     $this->doctrineHelper->expects($this->once())->method('getEntityRepository')->with('Oro\\Bundle\\NavigationBundle\\Entity\\Title')->will($this->returnValue($repo));
     $repo->expects($this->once())->method('findOneBy')->with(['route' => $routeName])->will($this->returnValue(null));
     $result = $this->titleProvider->getTitleTemplates($routeName);
     $this->assertEquals([], $result);
     // test that loaded titles are cached
     $this->titleProvider->getTitleTemplates($routeName);
 }
예제 #2
0
 /**
  * Load title template from database, fallback to config values
  *
  * @param string $route
  */
 public function loadByRoute($route)
 {
     $templates = $this->titleProvider->getTitleTemplates($route);
     if (!empty($templates)) {
         $this->setTemplate($templates['title']);
         $this->setShortTemplate($templates['short_title']);
     }
 }