function ComponentValidatorTest::dataProviderValidatePropsInvalid
Same name in this branch
- 10 core/modules/sdc/tests/src/Unit/ComponentValidatorTest.php \Drupal\Tests\sdc\Unit\ComponentValidatorTest::dataProviderValidatePropsInvalid()
Same name in other branches
- 11.x core/modules/sdc/tests/src/Unit/ComponentValidatorTest.php \Drupal\Tests\sdc\Unit\ComponentValidatorTest::dataProviderValidatePropsInvalid()
- 11.x core/tests/Drupal/Tests/Core/Theme/Component/ComponentValidatorTest.php \Drupal\Tests\Core\Theme\Component\ComponentValidatorTest::dataProviderValidatePropsInvalid()
Data provider with invalid component props.
Return value
array The data.
File
-
core/
tests/ Drupal/ Tests/ Core/ Theme/ Component/ ComponentValidatorTest.php, line 161
Class
- ComponentValidatorTest
- Unit tests for the component validation.
Namespace
Drupal\Tests\Core\Theme\ComponentCode
public static function dataProviderValidatePropsInvalid() : array {
return [
'missing required prop' => [
[
'href' => 'https://www.drupal.org',
'target' => '_blank',
'attributes' => new Attribute([
'key' => 'value',
]),
],
'my-cta',
static::loadComponentDefinitionFromFs('my-cta'),
],
'attributes with invalid object class' => [
[
'text' => 'Can Pica',
'href' => 'https://www.drupal.org',
'target' => '_blank',
'attributes' => new \stdClass(),
],
'my-cta',
static::loadComponentDefinitionFromFs('my-cta'),
],
'ctaTarget violates the allowed properties in the enum' => [
[
'ctaTarget' => 'foo',
],
'my-banner',
static::loadComponentDefinitionFromFs('my-banner'),
],
];
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.