function ComponentRenderTest::checkEmptyProps

Same name in this branch
  1. 10 core/tests/Drupal/KernelTests/Components/ComponentRenderTest.php \Drupal\KernelTests\Components\ComponentRenderTest::checkEmptyProps()
Same name in other branches
  1. 11.x core/modules/sdc/tests/src/Kernel/ComponentRenderTest.php \Drupal\Tests\sdc\Kernel\ComponentRenderTest::checkEmptyProps()
  2. 11.x 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/modules/sdc/tests/src/Kernel/ComponentRenderTest.php
Test that components render correctly.

File

core/modules/sdc/tests/src/Kernel/ComponentRenderTest.php, line 342

Class

ComponentRenderTest
Tests the correct rendering of components.

Namespace

Drupal\Tests\sdc\Kernel

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.