function ComponentRenderTest::checkEmptyProps

Same name in this branch
  1. 11.x core/modules/sdc/tests/src/Kernel/ComponentRenderTest.php \Drupal\Tests\sdc\Kernel\ComponentRenderTest::checkEmptyProps()
Same name in other branches
  1. 10 core/modules/sdc/tests/src/Kernel/ComponentRenderTest.php \Drupal\Tests\sdc\Kernel\ComponentRenderTest::checkEmptyProps()
  2. 10 core/tests/Drupal/KernelTests/Components/ComponentRenderTest.php \Drupal\KernelTests\Components\ComponentRenderTest::checkEmptyProps()

Ensure that components can have 0 props.

1 call to ComponentRenderTest::checkEmptyProps()
ComponentRenderTest::testRender in core/tests/Drupal/KernelTests/Components/ComponentRenderTest.php
Test that components render correctly.

File

core/tests/Drupal/KernelTests/Components/ComponentRenderTest.php, line 342

Class

ComponentRenderTest
Tests the correct rendering of components.

Namespace

Drupal\KernelTests\Components

Code

public function checkEmptyProps() : void {
    $build = [
        '#type' => 'component',
        '#component' => 'sdc_test:no-props',
        '#props' => [],
    ];
    $crawler = $this->renderComponentRenderArray($build);
    $this->assertEquals($crawler->filter('#sdc-wrapper')
        ->innerText(), 'This is a test string.');
}

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