function RenderTest::testProcessAttached

Same name in other branches
  1. 8.9.x core/tests/Drupal/KernelTests/Core/Render/RenderTest.php \Drupal\KernelTests\Core\Render\RenderTest::testProcessAttached()
  2. 10 core/tests/Drupal/KernelTests/Core/Render/RenderTest.php \Drupal\KernelTests\Core\Render\RenderTest::testProcessAttached()
  3. 11.x core/tests/Drupal/KernelTests/Core/Render/RenderTest.php \Drupal\KernelTests\Core\Render\RenderTest::testProcessAttached()

Tests that we get an exception when we try to attach an illegal type.

File

core/tests/Drupal/KernelTests/Core/Render/RenderTest.php, line 66

Class

RenderTest
Performs functional tests on \Drupal::service('renderer')->render().

Namespace

Drupal\KernelTests\Core\Render

Code

public function testProcessAttached() {
    // Specify invalid attachments in a render array.
    $build['#attached']['library'][] = 'core/drupal.states';
    $build['#attached']['drupal_process_states'][] = [];
    $renderer = $this->container
        ->get('bare_html_page_renderer');
    $this->expectException(\LogicException::class);
    $renderer->renderBarePage($build, '', 'maintenance_page');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.