Пример #1
0
 public function testGuessTemplateNameWithCascadingParentBundle()
 {
     $this->kernel->expects($this->at(1))->method('getBundle')->with($this->equalTo('BarBundle'), false)->will($this->returnValue(array($this->bundles['FooBarBundle'], $this->bundles['BarBundle'])));
     $this->kernel->expects($this->at(2))->method('getBundle')->with($this->equalTo('FooBundle'), false)->will($this->returnValue(array($this->bundles['FooBarBundle'], $this->bundles['BarBundle'], $this->bundles['FooBundle'])));
     $templateGuesser = new TemplateGuesser($this->kernel);
     $templateReference = $templateGuesser->guessTemplateName(array(new Fixture\FooBarBundle\Controller\FooBarController(), 'indexAction'), new Request());
     $this->assertEquals('FooBundle:FooBar:index.html.twig', (string) $templateReference);
 }
Пример #2
0
 public function testGuessTemplateWithoutBundle()
 {
     $templateGuesser = new TemplateGuesser($this->kernel);
     $templateReference = $templateGuesser->guessTemplateName(array(new Fixture\Controller\OutOfBundleController(), 'indexAction'), new Request());
     $this->assertEquals(':OutOfBundle:index.html.twig', (string) $templateReference);
 }
Пример #3
0
 /**
  * @expectedException InvalidArgumentException
  * @expectedExceptionMessage must be an array callable or an object defining the magic method __invoke. "object" given.
  */
 public function testInvalidController()
 {
     $this->kernel->getBundles();
     $templateGuesser = new TemplateGuesser($this->kernel);
     $templateReference = $templateGuesser->guessTemplateName(new Fixture\FooBundle\Controller\FooController(), new Request());
 }
Пример #4
0
 /**
  * @return string|TemplateReference
  */
 public function guessViewName()
 {
     $view = $this->guesser->guessTemplateName($this->controller, $this->request);
     return $view;
 }