function ComponentValidatorTest::dataProviderValidateDefinitionInvalid

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

Data provider with invalid component definitions.

Return value

array The data.

File

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

Class

ComponentValidatorTest
Unit tests for the component validation.

Namespace

Drupal\Tests\sdc\Unit

Code

public static function dataProviderValidateDefinitionInvalid() : array {
    $valid_cta = static::loadComponentDefinitionFromFs('my-cta');
    $cta_with_missing_required = $valid_cta;
    unset($cta_with_missing_required['path']);
    $cta_with_invalid_class = $valid_cta;
    $cta_with_invalid_class['props']['properties']['attributes']['type'] = 'Drupal\\Foo\\Invalid';
    $cta_with_invalid_enum = array_merge($valid_cta, [
        'extension_type' => 'invalid',
    ]);
    return [
        [
            $cta_with_missing_required,
        ],
        [
            $cta_with_invalid_class,
        ],
        [
            $cta_with_invalid_enum,
        ],
    ];
}

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