function ComponentValidatorTest::dataProviderValidatePropsValid

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

Data provider with valid component props.

Return value

array The data.

File

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

Class

ComponentValidatorTest
Unit tests for the component validation.

Namespace

Drupal\Tests\Core\Theme\Component

Code

public static function dataProviderValidatePropsValid() : array {
    return [
        [
            [
                'text' => 'Can Pica',
                'href' => 'https://www.drupal.org',
                'target' => '_blank',
                'attributes' => new Attribute([
                    'key' => 'value',
                ]),
            ],
            'my-cta',
            static::loadComponentDefinitionFromFs('my-cta'),
        ],
        [
            [],
            'my-banner',
            static::loadComponentDefinitionFromFs('my-banner'),
        ],
        [
            [
                'nonProp' => new \stdClass(),
            ],
            'my-banner',
            static::loadComponentDefinitionFromFs('my-banner'),
        ],
    ];
}

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