示例#1
0
 /**
  * Tests determining with two negotiators of which one does not apply.
  *
  * @see \Drupal\Core\Theme\ThemeNegotiatorInterface
  */
 public function testDetermineActiveThemeWithNotApplyingNegotiator()
 {
     $negotiator = $this->getMock('Drupal\\Core\\Theme\\ThemeNegotiatorInterface');
     $negotiator->expects($this->never())->method('determineActiveTheme');
     $negotiator->expects($this->once())->method('applies')->will($this->returnValue(FALSE));
     $this->themeNegotiator->addNegotiator($negotiator, 10);
     $negotiator = $this->getMock('Drupal\\Core\\Theme\\ThemeNegotiatorInterface');
     $negotiator->expects($this->once())->method('determineActiveTheme')->will($this->returnValue('example_test2'));
     $negotiator->expects($this->once())->method('applies')->will($this->returnValue(TRUE));
     $this->themeNegotiator->addNegotiator($negotiator, 0);
     $this->themeAccessCheck->expects($this->any())->method('checkAccess')->will($this->returnValue(TRUE));
     $route_match = new RouteMatch('test_route', new Route('/test-route'), array(), array());
     $theme = $this->themeNegotiator->determineActiveTheme($route_match);
     $this->assertEquals('example_test2', $theme);
 }
 /**
  * {@inheritdoc}
  */
 public function getContext()
 {
     return $this->themeNegotiator->determineActiveTheme($this->routeMatch) ?: 'stark';
 }