You are here

protected function AjaxRendererTest::setUp in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/tests/Drupal/Tests/Core/Controller/AjaxRendererTest.php \Drupal\Tests\Core\Controller\AjaxRendererTest::setUp()

Overrides UnitTestCase::setUp

File

core/tests/Drupal/Tests/Core/Controller/AjaxRendererTest.php, line 38
Contains \Drupal\Tests\Core\Controller\AjaxRendererTest.

Class

AjaxRendererTest
@coversDefaultClass \Drupal\Core\Render\MainContent\AjaxRenderer @group Ajax

Namespace

Drupal\Tests\Core\Controller

Code

protected function setUp() {
  $element_info_manager = $this
    ->getMock('Drupal\\Core\\Render\\ElementInfoManagerInterface');
  $element_info_manager
    ->expects($this
    ->any())
    ->method('getInfo')
    ->with('ajax')
    ->willReturn([
    '#header' => TRUE,
    '#commands' => array(),
    '#error' => NULL,
  ]);
  $this->ajaxRenderer = new TestAjaxRenderer($element_info_manager);
  $this->renderer = $this
    ->getMockBuilder('Drupal\\Core\\Render\\Renderer')
    ->disableOriginalConstructor()
    ->setMethods(NULL)
    ->getMock();
  $container = new ContainerBuilder();
  $container
    ->set('renderer', $this->renderer);
  \Drupal::setContainer($container);
}