You are here

public function RenderTest::testProcessAttached in Drupal 10

Same name and namespace in other branches
  1. 8 core/tests/Drupal/KernelTests/Core/Render/RenderTest.php \Drupal\KernelTests\Core\Render\RenderTest::testProcessAttached()
  2. 9 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');
}