Exemplo n.º 1
0
 public function testLoadByRouteWhenTitleDoesNotExist()
 {
     $route = 'test_route';
     $this->titleProvider->expects($this->once())->method('getTitleTemplates')->with($route)->will($this->returnValue([]));
     $this->titleService->loadByRoute($route);
     $this->assertNull($this->titleService->getTemplate());
     $this->assertNull($this->titleService->getShortTemplate());
 }
 /**
  * Tests case with fallback to config value
  */
 public function testLoadByRouteFallbackToConfig()
 {
     $route = 'test_route';
     $this->em->expects($this->once())->method('getRepository')->will($this->returnValue($this->repository));
     $this->repository->expects($this->once())->method('findOneBy')->with($this->equalTo(['route' => $route]))->will($this->returnValue(false));
     $titles = [$route => 'Test title template %placeholder%'];
     $this->titleService->setTitles($titles);
     $this->titleService->loadByRoute($route);
     $this->assertEquals($titles[$route], $this->titleService->getTemplate());
 }