function SchemaCompatibilityCheckerTest::dataProviderIsCompatible
Same name in this branch
- 10 core/modules/sdc/tests/src/Unit/SchemaCompatibilityCheckerTest.php \Drupal\Tests\sdc\Unit\SchemaCompatibilityCheckerTest::dataProviderIsCompatible()
Same name in other branches
- 11.x core/modules/sdc/tests/src/Unit/SchemaCompatibilityCheckerTest.php \Drupal\Tests\sdc\Unit\SchemaCompatibilityCheckerTest::dataProviderIsCompatible()
- 11.x core/tests/Drupal/Tests/Core/Theme/Component/SchemaCompatibilityCheckerTest.php \Drupal\Tests\Core\Theme\Component\SchemaCompatibilityCheckerTest::dataProviderIsCompatible()
Data provider for the test testIsCompatible.
Return value
array[] The batches of data.
File
-
core/
tests/ Drupal/ Tests/ Core/ Theme/ Component/ SchemaCompatibilityCheckerTest.php, line 51
Class
- SchemaCompatibilityCheckerTest
- @coversDefaultClass \Drupal\Core\Theme\Component\SchemaCompatibilityChecker @group sdc
Namespace
Drupal\Tests\Core\Theme\ComponentCode
public static function dataProviderIsCompatible() : array {
$schema = [
'type' => 'object',
'required' => [
'text',
],
'properties' => [
'text' => [
'type' => 'string',
'title' => 'Title',
'description' => 'The title for the button',
'minLength' => 2,
'examples' => [
'Press',
'Submit now',
],
],
'iconType' => [
'type' => 'string',
'title' => 'Icon Type',
'enum' => [
'power',
'like',
'external',
],
],
],
];
$schema_different_required = [
$schema,
'required' => [
'foo',
],
];
$schema_missing_icon_type = $schema;
unset($schema_missing_icon_type['properties']['iconType']);
$schema_missing_text = $schema;
unset($schema_missing_text['properties']['text']);
$schema_icon_with_number = $schema;
$schema_icon_with_number['properties']['iconType']['type'] = [
'string',
'number',
];
$schema_additional_enum = $schema;
$schema_additional_enum['properties']['iconType']['enum'][] = 'wow';
$schema_with_sub_schema = $schema;
$schema_with_sub_schema['properties']['parent'] = $schema;
$schema_with_sub_schema_enum = $schema;
$schema_with_sub_schema_enum['properties']['parent'] = $schema_additional_enum;
return [
[
$schema,
$schema,
TRUE,
],
[
$schema,
$schema_different_required,
FALSE,
],
[
$schema_different_required,
$schema,
FALSE,
],
[
$schema_missing_icon_type,
$schema,
TRUE,
],
[
$schema,
$schema_missing_icon_type,
TRUE,
],
[
$schema_missing_text,
$schema,
TRUE,
],
[
$schema,
$schema_missing_text,
TRUE,
],
[
$schema_icon_with_number,
$schema,
FALSE,
],
[
$schema,
$schema_icon_with_number,
TRUE,
],
[
$schema,
$schema_additional_enum,
TRUE,
],
[
$schema_additional_enum,
$schema,
FALSE,
],
[
$schema_with_sub_schema,
$schema_with_sub_schema,
TRUE,
],
[
$schema_with_sub_schema,
$schema_with_sub_schema_enum,
TRUE,
],
[
$schema_with_sub_schema_enum,
$schema_with_sub_schema,
FALSE,
],
];
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.