public function RenderTest::testProcessAttached in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/system/src/Tests/Common/RenderTest.php \Drupal\system\Tests\Common\RenderTest::testProcessAttached()
Tests that we get an exception when we try to attach an illegal type.
File
- core/
modules/ system/ src/ Tests/ Common/ RenderTest.php, line 55 - Contains \Drupal\system\Tests\Common\RenderTest.
Class
- RenderTest
- Performs functional tests on drupal_render().
Namespace
Drupal\system\Tests\CommonCode
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');
try {
$renderer
->renderBarePage($build, '', $this->container
->get('theme.manager')
->getActiveTheme()
->getName());
$this
->fail("Invalid #attachment 'drupal_process_states' allowed");
} catch (\LogicException $e) {
$this
->pass("Invalid #attachment 'drupal_process_states' not allowed");
}
}