function ComponentValidatorTest::testValidateDefinitionValid

Same name in this branch
  1. 10 core/modules/sdc/tests/src/Unit/ComponentValidatorTest.php \Drupal\Tests\sdc\Unit\ComponentValidatorTest::testValidateDefinitionValid()
Same name in other branches
  1. 11.x core/modules/sdc/tests/src/Unit/ComponentValidatorTest.php \Drupal\Tests\sdc\Unit\ComponentValidatorTest::testValidateDefinitionValid()
  2. 11.x core/tests/Drupal/Tests/Core/Theme/Component/ComponentValidatorTest.php \Drupal\Tests\Core\Theme\Component\ComponentValidatorTest::testValidateDefinitionValid()

Tests that valid component definitions don't cause errors.

@dataProvider dataProviderValidateDefinitionValid

Throws

\Drupal\Core\Render\Component\Exception\InvalidComponentException

File

core/tests/Drupal/Tests/Core/Theme/Component/ComponentValidatorTest.php, line 29

Class

ComponentValidatorTest
Unit tests for the component validation.

Namespace

Drupal\Tests\Core\Theme\Component

Code

public function testValidateDefinitionValid(array $definition) : void {
    $component_validator = new ComponentValidator();
    $component_validator->setValidator();
    $this->assertTrue($component_validator->validateDefinition($definition, TRUE), 'The invalid component definition did not throw an error.');
}

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