function ComponentValidatorTest::testValidatePropsInvalid

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

Tests that invalid props are handled properly.

@dataProvider dataProviderValidatePropsInvalid

Throws

\Drupal\sdc\Exception\InvalidComponentException

File

core/modules/sdc/tests/src/Unit/ComponentValidatorTest.php, line 145

Class

ComponentValidatorTest
Unit tests for the component validation.

Namespace

Drupal\Tests\sdc\Unit

Code

public function testValidatePropsInvalid(array $context, string $component_id, array $definition) : void {
    $component = new Component([
        'app_root' => '/fake/path/root',
    ], 'sdc_test:' . $component_id, $definition);
    $this->expectException(InvalidComponentException::class);
    $component_validator = new ComponentValidator();
    $component_validator->setValidator();
    $component_validator->validateProps($context, $component);
}

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