diff --git a/config/optional/experience_builder.component.sdc_test_all_props+all-props.yml b/config/optional/experience_builder.component.sdc_test_all_props+all-props.yml new file mode 100644 index 0000000000000000000000000000000000000000..9da7e8fd4965e49f103ed468a79fc70c8f242cc5 --- /dev/null +++ b/config/optional/experience_builder.component.sdc_test_all_props+all-props.yml @@ -0,0 +1,89 @@ +# @todo Remove this file in https://www.drupal.org/project/experience_builder/issues/3463999 +langcode: en +status: true +dependencies: + module: + - datetime + - image + - options + - path + - sdc_test_all_props +label: All Props +component: sdc_test_all_props+all-props +defaults: + props: + test_REQUIRED_string: + field_type: string + field_widget: string_textfield + default_value: null + expression: ℹ︎string␟value + test_integer: + field_type: integer + field_widget: number + default_value: null + expression: ℹ︎integer␟value + test_integer_range_minimum: + field_type: integer + field_widget: number + default_value: null + expression: ℹ︎integer␟value + test_integer_range_minimum_maximum_timestamps: + field_type: integer + field_widget: number + default_value: null + expression: ℹ︎integer␟value + test_object_drupal_image: + field_type: image + field_widget: image_image + default_value: null + expression: 'ℹ︎image␟{src↝entity␜␜entity:file␝uri␞0␟url,alt↠alt,width↠width,height↠height}' + test_string: + field_type: string + field_widget: string_textfield + default_value: null + expression: ℹ︎string␟value + test_string_enum: + field_type: list_string + field_widget: options_select + default_value: null + expression: ℹ︎list_string␟value + test_string_format_date: + field_type: datetime + field_widget: datetime_default + default_value: null + expression: ℹ︎datetime␟value + test_string_format_date_time: + field_type: datetime + field_widget: datetime_default + default_value: null + expression: ℹ︎datetime␟value + test_string_format_email: + field_type: email + field_widget: email_default + default_value: null + expression: ℹ︎email␟value + test_string_format_idn_email: + field_type: email + field_widget: email_default + default_value: null + expression: ℹ︎email␟value + test_string_format_iri: + field_type: uri + field_widget: uri + default_value: null + expression: ℹ︎uri␟value + test_string_format_iri_reference: + field_type: path + field_widget: path + default_value: null + expression: ℹ︎path␟alias + test_string_format_uri: + field_type: uri + field_widget: uri + default_value: null + expression: ℹ︎uri␟value + test_string_format_uri_reference: + field_type: path + field_widget: path + default_value: null + expression: ℹ︎path␟alias diff --git a/src/Controller/SdcController.php b/src/Controller/SdcController.php index eb6965aab6d7df2dfb67e3c9513b04d3562584d2..faf34933e701dbacfc518d9e0050275bcd4fdd7c 100644 --- a/src/Controller/SdcController.php +++ b/src/Controller/SdcController.php @@ -340,7 +340,7 @@ final class SdcController extends ControllerBase { $component_tree_field_item = $this->clientLayoutAndModelToXbField($layout, $model); $build = self::wrapComponentsForPreview($component_tree_field_item->toRenderable()); - $this->renderer->renderInIsolation($build); + $component_tree_html = $this->renderer->renderInIsolation($build); $assets = AttachedAssets::createFromRenderArray(isset($build['#attached']) ? $build @@ -367,7 +367,7 @@ HTML; <body> <div class="sortable-list" data-xb-uuid="root"> HTML; - $html .= $build['#markup']; + $html .= $component_tree_html; $html .= <<<HTML </body> HTML; diff --git a/src/Form/ComponentEditForm.php b/src/Form/ComponentEditForm.php index 846dc5029c4717eed4720b2849b1809f3cb9a434..73e88e4c863186a81dac7200e17320639c968b3e 100644 --- a/src/Form/ComponentEditForm.php +++ b/src/Form/ComponentEditForm.php @@ -158,6 +158,12 @@ class ComponentEditForm extends EntityForm implements ContainerInjectionInterfac $field_type_options = []; $widget_forms = []; if (empty($static_prop_source_suggestions)) { + // @see https://www.drupal.org/project/experience_builder/issues/3463583#comment-15710082 + // @todo This, and this entire file, will be removed in https://www.drupal.org/project/experience_builder/issues/3464025 + if (array_key_exists($component_prop_name, $this->entity->get('defaults')['props'])) { + // @phpstan-ignore-next-line + \Drupal::messenger()->addWarning('This test-only component is provided as-is and cannot be edited.'); + } $form[Component::convertMachineNameToId($component->getPluginId())][$component_prop_name]['skip'] = [ '#type' => 'container', '#markup' => $storable_prop_shape === NULL diff --git a/tests/modules/sdc_test_all_props/components/all-props/all-props.component.yml b/tests/modules/sdc_test_all_props/components/all-props/all-props.component.yml index 17197914eb2dc598e310923ba88bfad8434a9527..ad3003fc096da7fb55dc850de93e09bc3f0cd972 100644 --- a/tests/modules/sdc_test_all_props/components/all-props/all-props.component.yml +++ b/tests/modules/sdc_test_all_props/components/all-props/all-props.component.yml @@ -3,68 +3,88 @@ name: All props props: type: object required: - - test-REQUIRED-string + - test_REQUIRED_string properties: - test-string: + test_string: title: 'String' type: string - test-REQUIRED-string: + examples: + - Hello, world! + test_REQUIRED_string: title: 'String' type: string - test-string-enum: + examples: + - Hello, required world! + test_string_enum: title: 'String' type: string enum: - foo - bar + examples: + - foo # Built-in formats: dates and times # @see https://json-schema.org/understanding-json-schema/reference/string#dates-and-times - test-string-format-date-time: + test_string_format_date_time: type: string format: date-time - test-string-format-date: + examples: + - '2018-11-13T20:20:39+00:00' + test_string_format_date: type: string format: date - test-string-format-time: + examples: + - '2018-11-13' + test_string_format_time: type: string format: time - test-string-format-duration: + examples: + - '20:20:39' + # @todo 🐛 This is copy/pasted from https://json-schema.org/understanding-json-schema/reference/string#dates-and-times but is refused by justinrainbow/json-schema! + # - '20:20:39+00:00' + test_string_format_duration: type: string format: duration # Built-in formats: email addresses. # @see https://json-schema.org/understanding-json-schema/reference/string#email-addresses - test-string-format-email: + test_string_format_email: type: string format: email - test-string-format-idn-email: + examples: + - hello@example.com + test_string_format_idn_email: type: string format: idn-email + examples: + - hello@idn.example.com # Built-in formats: hostnames. # @see https://json-schema.org/understanding-json-schema/reference/string#hostnames - test-string-format-hostname: + test_string_format_hostname: type: string format: hostname - test-string-format-idn-hostname: + test_string_format_idn_hostname: type: string format: idn-hostname # Built-in formats: IP addresses. # @see https://json-schema.org/understanding-json-schema/reference/string#ip-addresses - test-string-format-ipv4: + test_string_format_ipv4: type: string format: ipv4 - test-string-format-ipv6: + test_string_format_ipv6: type: string format: ipv6 # Built-in formats: resource identifiers. # @see https://json-schema.org/understanding-json-schema/reference/string#resource-identifiers - test-string-format-uuid: + test_string_format_uuid: type: string format: uuid - test-string-format-uri: + test_string_format_uri: title: 'String, format=uri' type: string format: uri - test-string-format-uri-image: + examples: + - https://uri.example.com + test_string_format_uri_image: title: 'String, format=uri, images only' $ref: json-schema-definitions://experience_builder.module/image-uri # @todo Remove in https://www.drupal.org/project/drupal/issues/3352063 — should not be necessary, but removing this causes \Drupal\Core\Theme\Component\ComponentMetadata::parseSchemaInfo() to generate `type = ['', 'object'] 🐛 @@ -74,53 +94,69 @@ props: # format: uri # # @see \Drupal\image\Plugin\Field\FieldType\ImageItem::defaultFieldSettings() # pattern: '\.(png|gif|jpg|jpeg|webp)$' - test-string-format-uri-reference: + test_string_format_uri_reference: type: string format: uri-reference - test-string-format-iri: + examples: + - /example-uri + test_string_format_iri: type: string format: iri - test-string-format-iri-reference: + examples: + - https://iri.example.com + test_string_format_iri_reference: type: string format: iri-reference + examples: + - /example-iri # Built-in formats: URI template. # @see https://json-schema.org/understanding-json-schema/reference/string#uri-template - test-string-format-uri-template: + test_string_format_uri_template: type: string format: uri-template # Built-in formats: JSON Pointer. # @see https://json-schema.org/understanding-json-schema/reference/string#json-pointer - test-string-format-json-pointer: + test_string_format_json_pointer: type: string format: json-pointer - test-string-format-relative-json-pointer: + test_string_format_relative_json_pointer: type: string format: relative-json-pointer # Built-in formats: Regular expressions. # @see https://json-schema.org/understanding-json-schema/reference/string#regular-expressions - test-string-format-regex: + test_string_format_regex: type: string format: regex - test-integer: + test_integer: type: integer - test-integer-range-minimum: + examples: + - -42 + test_integer_range_minimum: type: integer minimum: 0 - test-integer-range-minimum-maximum-timestamps: + examples: + - 42 + test_integer_range_minimum_maximum_timestamps: type: integer minimum: -2147483648 maximum: 2147483648 - + examples: + - 1730718000 # The "image" predefined object format. # @todo Agree on one special case, for ecosystem-wide formats: `json-schema-definitions://drupal/<something>`, so `json-schema-definitions://drupal/image` here. - test-object-drupal-image: + test_object_drupal_image: $ref: json-schema-definitions://experience_builder.module/image # @todo Remove in https://www.drupal.org/project/drupal/issues/3352063 — should not be necessary, but removing this causes \Drupal\Core\Theme\Component\ComponentMetadata::parseSchemaInfo() to generate `type = ['', 'object'] 🐛 type: object + examples: + - src: https://placehold.co/600x400.png + alt: 'Boring placeholder' + width: 600 + height: 400 # The "date-range" object format for this module. - test-object-drupal-date-range: + test_object_drupal_date_range: $ref: json-schema-definitions://sdc_test_all_props.module/date-range # @todo Remove in https://www.drupal.org/project/drupal/issues/3352063 — should not be necessary, but removing this causes \Drupal\Core\Theme\Component\ComponentMetadata::parseSchemaInfo() to generate `type = ['', 'object'] 🐛 type: object diff --git a/tests/modules/sdc_test_all_props/components/all-props/all-props.twig b/tests/modules/sdc_test_all_props/components/all-props/all-props.twig index 7f1404818fabdb2bbea560488974d6974a4a143b..9f20a3d9c4321921bdca133ecec02c4e047eaf89 100644 --- a/tests/modules/sdc_test_all_props/components/all-props/all-props.twig +++ b/tests/modules/sdc_test_all_props/components/all-props/all-props.twig @@ -1,6 +1,81 @@ <div> - <code>{{ test-string }}</code> - <code>{{ test-string-format-date }}</code> - <code>{{ test-string-format-uri }}</code> - <code>{{ test-string-format-iri }}</code> + <h2>Boolean shapes</h2> + <p>None yet.</p> + <h2>String shapes</h2> + <dl> + <dt>test_REQUIRED_string</dt> + <dd><code>{{ test_REQUIRED_string }}</code></dd> + <dt>test_string</dt> + <dd><code>{{ test_string }}</code></dd> + <dt>test_string_enum</dt> + <dd><code>{{ test_string_enum }}</code></dd> + <dt>test_string_format_date_time</dt> + <dd><code>{{ test_string_format_date_time }}</code></dd> + <dt>test_string_format_date</dt> + <dd><code>{{ test_string_format_date }}</code></dd> + <dt>test_string_format_time</dt> + <dd><code>{{ test_string_format_time }}</code></dd> + <dt>test_string_format_email</dt> + <dd><code>{{ test_string_format_email }}</code></dd> + <dt>test_string_format_idn_email</dt> + <dd><code>{{ test_string_format_idn_email }}</code></dd> + <dt>test_string_format_hostname</dt> + <dd><code>{{ test_string_format_hostname }}</code></dd> + <dt>test_string_format_idn_hostname</dt> + <dd><code>{{ test_string_format_idn_hostname }}</code></dd> + <dt>test_string_format_ipv4</dt> + <dd><code>{{ test_string_format_ipv4 }}</code></dd> + <dt>test_string_format_ipv6</dt> + <dd><code>{{ test_string_format_ipv6 }}</code></dd> + <dt>test_string_format_uuid</dt> + <dd><code>{{ test_string_format_uuid }}</code></dd> + <dt>test_string_format_uri</dt> + <dd><code>{{ test_string_format_uri }}</code></dd> + <dt>test_string_format_uri_image</dt> + <dd><code>{{ test_string_format_uri_image }}</code></dd> + <dt>test_string_format_uri_reference</dt> + <dd><code>{{ test_string_format_uri_reference }}</code></dd> + <dt>test_string_format_iri</dt> + <dd><code>{{ test_string_format_iri }}</code></dd> + <dt>test_string_format_iri_reference</dt> + <dd><code>{{ test_string_format_iri_reference }}</code></dd> + <dt>test_string_format_uri_template</dt> + <dd><code>{{ test_string_format_uri_template }}</code></dd> + <dt>test_string_format_json_pointer</dt> + <dd><code>{{ test_string_format_json_pointer }}</code></dd> + <dt>test_string_format_regex</dt> + <dd><code>{{ test_string_format_regex }}</code></dd> + </dl> + <h2>Integer shapes</h2> + <dl> + <dt>test_integer</dt> + <dd><code>{{ test_integer }}</code></dd> + <dt>test_integer_range_minimum</dt> + <dd><code>{{ test_integer_range_minimum }}</code></dd> + <dt>test_integer_range_minimum_maximum_timestamps</dt> + <dd><code>{{ test_integer_range_minimum_maximum_timestamps }}</code></dd> + </dl> + <h2>Number shapes</h2> + <p>None yet.</p> + <h2>Object shapes</h2> + <dl> + <dt>test_object_drupal_image</dt> + <dd> + <ul> + <li>src: <code>{{ test_object_drupal_image.src }}</code> + <li>alt: <code>{{ test_object_drupal_image.alt }}</code> + <li>width: <code>{{ test_object_drupal_image.width }}</code> + <li>height: <code>{{ test_object_drupal_image.height }}</code> + </ul> + </dd> + <dt>test_object_drupal_date_range</dt> + <dd> + <ul> + <li>from: <code>{{ test_object_drupal_date_range.from }}</code> + <li>to: <code>{{ test_object_drupal_date_range.to }}</code> + </ul> + </dd> + </dl> + <h2>Array shapes</h2> + <p>None yet.</p> </div> diff --git a/tests/src/Functional/DefaultConfigTest.php b/tests/src/Functional/DefaultConfigTest.php index be6c19a1a99e010901bcd1d77090053453eda500..65190e946e2850fd107590ce49da48e45ddb65af 100644 --- a/tests/src/Functional/DefaultConfigTest.php +++ b/tests/src/Functional/DefaultConfigTest.php @@ -18,7 +18,10 @@ class DefaultConfigTest extends BrowserTestBase { /** * {@inheritdoc} */ - protected static $modules = ['experience_builder']; + protected static $modules = [ + 'experience_builder', + 'sdc_test_all_props', + ]; /** * {@inheritdoc} diff --git a/tests/src/Kernel/FieldForComponentSuggesterTest.php b/tests/src/Kernel/FieldForComponentSuggesterTest.php index 0e929eddd36ad770a51cf3ffd6d130aa70f0b6a4..aa4fcdbc7f74a8f006c2cefa383789afd8bdd623 100644 --- a/tests/src/Kernel/FieldForComponentSuggesterTest.php +++ b/tests/src/Kernel/FieldForComponentSuggesterTest.php @@ -165,7 +165,7 @@ class FieldForComponentSuggesterTest extends KernelTestBase { 'sdc_test_all_props:all-props', 'entity:node:foo', [ - '⿲sdc_test_all_props:all-props␟test-string' => [ + '⿲sdc_test_all_props:all-props␟test_string' => [ 'required' => FALSE, 'types' => [ 'Text (plain, long)' => 'ℹ︎string_long␟value', @@ -178,7 +178,7 @@ class FieldForComponentSuggesterTest extends KernelTestBase { ], 'adapters' => [], ], - '⿲sdc_test_all_props:all-props␟test-REQUIRED-string' => [ + '⿲sdc_test_all_props:all-props␟test_REQUIRED_string' => [ 'required' => TRUE, 'types' => [ 'Text (plain, long)' => 'ℹ︎string_long␟value', @@ -189,13 +189,13 @@ class FieldForComponentSuggesterTest extends KernelTestBase { ], 'adapters' => [], ], - '⿲sdc_test_all_props:all-props␟test-string-enum' => [ + '⿲sdc_test_all_props:all-props␟test_string_enum' => [ 'required' => FALSE, 'types' => [], 'instances' => [], 'adapters' => [], ], - '⿲sdc_test_all_props:all-props␟test-string-format-date-time' => [ + '⿲sdc_test_all_props:all-props␟test_string_format_date_time' => [ 'required' => FALSE, 'types' => [ 'Date' => 'ℹ︎datetime␟value', @@ -205,7 +205,7 @@ class FieldForComponentSuggesterTest extends KernelTestBase { ], 'adapters' => [], ], - '⿲sdc_test_all_props:all-props␟test-string-format-date' => [ + '⿲sdc_test_all_props:all-props␟test_string_format_date' => [ 'required' => FALSE, 'types' => [ 'Date' => 'ℹ︎datetime␟value', @@ -215,19 +215,19 @@ class FieldForComponentSuggesterTest extends KernelTestBase { ], 'adapters' => [], ], - '⿲sdc_test_all_props:all-props␟test-string-format-time' => [ + '⿲sdc_test_all_props:all-props␟test_string_format_time' => [ 'required' => FALSE, 'types' => [], 'instances' => [], 'adapters' => [], ], - '⿲sdc_test_all_props:all-props␟test-string-format-duration' => [ + '⿲sdc_test_all_props:all-props␟test_string_format_duration' => [ 'required' => FALSE, 'types' => [], 'instances' => [], 'adapters' => [], ], - '⿲sdc_test_all_props:all-props␟test-string-format-email' => [ + '⿲sdc_test_all_props:all-props␟test_string_format_email' => [ 'required' => FALSE, 'types' => [ 'Email' => 'ℹ︎email␟value', @@ -238,7 +238,7 @@ class FieldForComponentSuggesterTest extends KernelTestBase { ], 'adapters' => [], ], - '⿲sdc_test_all_props:all-props␟test-string-format-idn-email' => [ + '⿲sdc_test_all_props:all-props␟test_string_format_idn_email' => [ 'required' => FALSE, 'types' => [ 'Email' => 'ℹ︎email␟value', @@ -249,31 +249,31 @@ class FieldForComponentSuggesterTest extends KernelTestBase { ], 'adapters' => [], ], - '⿲sdc_test_all_props:all-props␟test-string-format-hostname' => [ + '⿲sdc_test_all_props:all-props␟test_string_format_hostname' => [ 'required' => FALSE, 'types' => [], 'instances' => [], 'adapters' => [], ], - '⿲sdc_test_all_props:all-props␟test-string-format-idn-hostname' => [ + '⿲sdc_test_all_props:all-props␟test_string_format_idn_hostname' => [ 'required' => FALSE, 'types' => [], 'instances' => [], 'adapters' => [], ], - '⿲sdc_test_all_props:all-props␟test-string-format-ipv4' => [ + '⿲sdc_test_all_props:all-props␟test_string_format_ipv4' => [ 'required' => FALSE, 'types' => [], 'instances' => [], 'adapters' => [], ], - '⿲sdc_test_all_props:all-props␟test-string-format-ipv6' => [ + '⿲sdc_test_all_props:all-props␟test_string_format_ipv6' => [ 'required' => FALSE, 'types' => [], 'instances' => [], 'adapters' => [], ], - '⿲sdc_test_all_props:all-props␟test-string-format-uuid' => [ + '⿲sdc_test_all_props:all-props␟test_string_format_uuid' => [ 'required' => FALSE, 'types' => [ 'File' => 'ℹ︎file␟entity␜␜entity:file␝uuid␞0␟value', @@ -288,7 +288,7 @@ class FieldForComponentSuggesterTest extends KernelTestBase { ], 'adapters' => [], ], - '⿲sdc_test_all_props:all-props␟test-string-format-uri' => [ + '⿲sdc_test_all_props:all-props␟test_string_format_uri' => [ 'required' => FALSE, 'types' => [ 'File' => 'ℹ︎file␟entity␜␜entity:file␝uri␞0␟value', @@ -300,7 +300,7 @@ class FieldForComponentSuggesterTest extends KernelTestBase { ], 'adapters' => [], ], - '⿲sdc_test_all_props:all-props␟test-string-format-uri-image' => [ + '⿲sdc_test_all_props:all-props␟test_string_format_uri_image' => [ 'required' => FALSE, 'types' => [ 'Image' => 'ℹ︎image␟entity␜␜entity:file␝uri␞0␟value', @@ -312,7 +312,7 @@ class FieldForComponentSuggesterTest extends KernelTestBase { 'Extract image URL' => 'image_extract_url', ], ], - '⿲sdc_test_all_props:all-props␟test-string-format-uri-reference' => [ + '⿲sdc_test_all_props:all-props␟test_string_format_uri_reference' => [ 'required' => FALSE, 'types' => [ 'Path' => 'ℹ︎path␟alias', @@ -322,7 +322,7 @@ class FieldForComponentSuggesterTest extends KernelTestBase { ], 'adapters' => [], ], - '⿲sdc_test_all_props:all-props␟test-string-format-iri' => [ + '⿲sdc_test_all_props:all-props␟test_string_format_iri' => [ 'required' => FALSE, 'types' => [ 'File' => 'ℹ︎file␟entity␜␜entity:file␝uri␞0␟value', @@ -334,7 +334,7 @@ class FieldForComponentSuggesterTest extends KernelTestBase { ], 'adapters' => [], ], - '⿲sdc_test_all_props:all-props␟test-string-format-iri-reference' => [ + '⿲sdc_test_all_props:all-props␟test_string_format_iri_reference' => [ 'required' => FALSE, 'types' => [ 'Path' => 'ℹ︎path␟alias', @@ -344,31 +344,31 @@ class FieldForComponentSuggesterTest extends KernelTestBase { ], 'adapters' => [], ], - '⿲sdc_test_all_props:all-props␟test-string-format-uri-template' => [ + '⿲sdc_test_all_props:all-props␟test_string_format_uri_template' => [ 'required' => FALSE, 'types' => [], 'instances' => [], 'adapters' => [], ], - '⿲sdc_test_all_props:all-props␟test-string-format-json-pointer' => [ + '⿲sdc_test_all_props:all-props␟test_string_format_json_pointer' => [ 'required' => FALSE, 'types' => [], 'instances' => [], 'adapters' => [], ], - '⿲sdc_test_all_props:all-props␟test-string-format-relative-json-pointer' => [ + '⿲sdc_test_all_props:all-props␟test_string_format_relative_json_pointer' => [ 'required' => FALSE, 'types' => [], 'instances' => [], 'adapters' => [], ], - '⿲sdc_test_all_props:all-props␟test-string-format-regex' => [ + '⿲sdc_test_all_props:all-props␟test_string_format_regex' => [ 'required' => FALSE, 'types' => [], 'instances' => [], 'adapters' => [], ], - '⿲sdc_test_all_props:all-props␟test-integer' => [ + '⿲sdc_test_all_props:all-props␟test_integer' => [ 'required' => FALSE, 'types' => [ 'File' => 'ℹ︎file␟entity␜␜entity:file␝uid␞0␟target_id', @@ -392,13 +392,13 @@ class FieldForComponentSuggesterTest extends KernelTestBase { ], 'adapters' => [], ], - '⿲sdc_test_all_props:all-props␟test-integer-range-minimum' => [ + '⿲sdc_test_all_props:all-props␟test_integer_range_minimum' => [ 'required' => FALSE, 'types' => [], 'instances' => [], 'adapters' => [], ], - '⿲sdc_test_all_props:all-props␟test-integer-range-minimum-maximum-timestamps' => [ + '⿲sdc_test_all_props:all-props␟test_integer_range_minimum_maximum_timestamps' => [ 'required' => FALSE, 'types' => [ 'Timestamp' => 'ℹ︎timestamp␟value', @@ -409,7 +409,7 @@ class FieldForComponentSuggesterTest extends KernelTestBase { ], 'adapters' => [], ], - '⿲sdc_test_all_props:all-props␟test-object-drupal-image' => [ + '⿲sdc_test_all_props:all-props␟test_object_drupal_image' => [ 'required' => FALSE, 'types' => [ 'Image' => 'ℹ︎image␟{src↝entity␜␜entity:file␝uri␞0␟url,alt↠alt,width↠width,height↠height}', @@ -422,7 +422,7 @@ class FieldForComponentSuggesterTest extends KernelTestBase { 'Make relative image URL absolute' => 'image_url_rel_to_abs', ], ], - '⿲sdc_test_all_props:all-props␟test-object-drupal-date-range' => [ + '⿲sdc_test_all_props:all-props␟test_object_drupal_date_range' => [ 'required' => FALSE, 'types' => [ 'Date range' => 'ℹ︎daterange␟{from↠end_value,to↠value}', diff --git a/tests/src/Kernel/SdcPropToFieldTypePropTest.php b/tests/src/Kernel/SdcPropToFieldTypePropTest.php index caf5e65a71b5a3cc813e0a89cb474976cdd7fe88..3021ce4221a6dca026a6f29da4e971bfd34831c2 100644 --- a/tests/src/Kernel/SdcPropToFieldTypePropTest.php +++ b/tests/src/Kernel/SdcPropToFieldTypePropTest.php @@ -570,7 +570,7 @@ class SdcPropToFieldTypePropTest extends KernelTestBase { 'adapter_matches_field_type' => [], 'adapter_matches_instance' => [], ], - '⿲sdc_test_all_props:all-props␟test-string' => [ + '⿲sdc_test_all_props:all-props␟test_string' => [ 'storage' => $all_string_storage_props, 'format_any_prop' => [ 'ℹ︎file␟description', @@ -595,7 +595,7 @@ class SdcPropToFieldTypePropTest extends KernelTestBase { 'adapter_matches_field_type' => [], 'adapter_matches_instance' => [], ], - '⿲sdc_test_all_props:all-props␟test-REQUIRED-string' => [ + '⿲sdc_test_all_props:all-props␟test_REQUIRED_string' => [ 'storage' => [ 'ℹ︎daterange␟end_value', 'ℹ︎daterange␟value', @@ -635,7 +635,7 @@ class SdcPropToFieldTypePropTest extends KernelTestBase { 'adapter_matches_field_type' => [], 'adapter_matches_instance' => [], ], - '⿲sdc_test_all_props:all-props␟test-string-enum' => [ + '⿲sdc_test_all_props:all-props␟test_string_enum' => [ 'storage' => $all_string_storage_props, 'format_any_prop' => [ // @todo Make this work using the `list_string` field type @@ -645,7 +645,7 @@ class SdcPropToFieldTypePropTest extends KernelTestBase { 'adapter_matches_field_type' => [], 'adapter_matches_instance' => [], ], - '⿲sdc_test_all_props:all-props␟test-string-format-' . JsonSchemaStringFormat::DATE_TIME->value => [ + '⿲sdc_test_all_props:all-props␟test_string_format_' . str_replace('-', '_', JsonSchemaStringFormat::DATE_TIME->value) => [ 'storage' => $all_string_storage_props, 'format_any_prop' => [ 'ℹ︎daterange␟end_value', @@ -663,7 +663,7 @@ class SdcPropToFieldTypePropTest extends KernelTestBase { 'adapter_matches_field_type' => [], 'adapter_matches_instance' => [], ], - '⿲sdc_test_all_props:all-props␟test-string-format-' . JsonSchemaStringFormat::DATE->value => [ + '⿲sdc_test_all_props:all-props␟test_string_format_' . JsonSchemaStringFormat::DATE->value => [ 'storage' => $all_string_storage_props, 'format_any_prop' => [ 'ℹ︎daterange␟end_value', @@ -681,7 +681,7 @@ class SdcPropToFieldTypePropTest extends KernelTestBase { 'adapter_matches_field_type' => [], 'adapter_matches_instance' => [], ], - '⿲sdc_test_all_props:all-props␟test-string-format-' . JsonSchemaStringFormat::TIME->value => [ + '⿲sdc_test_all_props:all-props␟test_string_format_' . JsonSchemaStringFormat::TIME->value => [ 'storage' => $all_string_storage_props, 'format_any_prop' => [ // @todo Adapter for @FieldType=timestamp -> `type:string,format=time`, @FieldType=datetime -> `type:string,format=time` @@ -691,7 +691,7 @@ class SdcPropToFieldTypePropTest extends KernelTestBase { 'adapter_matches_field_type' => [], 'adapter_matches_instance' => [], ], - '⿲sdc_test_all_props:all-props␟test-string-format-' . JsonSchemaStringFormat::DURATION->value => [ + '⿲sdc_test_all_props:all-props␟test_string_format_' . JsonSchemaStringFormat::DURATION->value => [ 'storage' => $all_string_storage_props, 'format_any_prop' => [ // @todo No field type in Drupal core uses \Drupal\Core\TypedData\Plugin\DataType\DurationIso8601. @@ -701,7 +701,7 @@ class SdcPropToFieldTypePropTest extends KernelTestBase { 'adapter_matches_field_type' => [], 'adapter_matches_instance' => [], ], - '⿲sdc_test_all_props:all-props␟test-string-format-' . JsonSchemaStringFormat::EMAIL->value => [ + '⿲sdc_test_all_props:all-props␟test_string_format_' . JsonSchemaStringFormat::EMAIL->value => [ 'storage' => $all_string_storage_props, 'format_any_prop' => [ 'ℹ︎email␟value', @@ -722,7 +722,7 @@ class SdcPropToFieldTypePropTest extends KernelTestBase { 'adapter_matches_field_type' => [], 'adapter_matches_instance' => [], ], - '⿲sdc_test_all_props:all-props␟test-string-format-' . JsonSchemaStringFormat::IDN_EMAIL->value => [ + '⿲sdc_test_all_props:all-props␟test_string_format_' . str_replace('-', '_', JsonSchemaStringFormat::IDN_EMAIL->value) => [ 'storage' => $all_string_storage_props, 'format_any_prop' => [ 'ℹ︎email␟value', @@ -743,7 +743,7 @@ class SdcPropToFieldTypePropTest extends KernelTestBase { 'adapter_matches_field_type' => [], 'adapter_matches_instance' => [], ], - '⿲sdc_test_all_props:all-props␟test-string-format-' . JsonSchemaStringFormat::HOSTNAME->value => [ + '⿲sdc_test_all_props:all-props␟test_string_format_' . JsonSchemaStringFormat::HOSTNAME->value => [ 'storage' => $all_string_storage_props, 'format_any_prop' => [ // @todo adapter from `type: string, format=uri`? @@ -753,7 +753,7 @@ class SdcPropToFieldTypePropTest extends KernelTestBase { 'adapter_matches_field_type' => [], 'adapter_matches_instance' => [], ], - '⿲sdc_test_all_props:all-props␟test-string-format-' . JsonSchemaStringFormat::IDN_HOSTNAME->value => [ + '⿲sdc_test_all_props:all-props␟test_string_format_' . str_replace('-', '_', JsonSchemaStringFormat::IDN_HOSTNAME->value) => [ 'storage' => $all_string_storage_props, 'format_any_prop' => [ // phpcs:disable @@ -769,7 +769,7 @@ class SdcPropToFieldTypePropTest extends KernelTestBase { 'adapter_matches_field_type' => [], 'adapter_matches_instance' => [], ], - '⿲sdc_test_all_props:all-props␟test-string-format-' . JsonSchemaStringFormat::IPV4->value => [ + '⿲sdc_test_all_props:all-props␟test_string_format_' . JsonSchemaStringFormat::IPV4->value => [ 'storage' => $all_string_storage_props, 'format_any_prop' => [ // @todo Update \Drupal\sdc\Component\ComponentValidator to disallow this — does not make sense for presenting information? @@ -779,7 +779,7 @@ class SdcPropToFieldTypePropTest extends KernelTestBase { 'adapter_matches_field_type' => [], 'adapter_matches_instance' => [], ], - '⿲sdc_test_all_props:all-props␟test-string-format-' . JsonSchemaStringFormat::IPV6->value => [ + '⿲sdc_test_all_props:all-props␟test_string_format_' . JsonSchemaStringFormat::IPV6->value => [ 'storage' => $all_string_storage_props, 'format_any_prop' => [ // @todo Update \Drupal\sdc\Component\ComponentValidator to disallow this — does not make sense for presenting information? @@ -789,7 +789,7 @@ class SdcPropToFieldTypePropTest extends KernelTestBase { 'adapter_matches_field_type' => [], 'adapter_matches_instance' => [], ], - '⿲sdc_test_all_props:all-props␟test-string-format-' . JsonSchemaStringFormat::UUID->value => [ + '⿲sdc_test_all_props:all-props␟test_string_format_' . JsonSchemaStringFormat::UUID->value => [ 'storage' => $all_string_storage_props, 'format_any_prop' => [ 'ℹ︎file␟entity␜␜entity:file␝uuid␞0␟value', @@ -814,7 +814,7 @@ class SdcPropToFieldTypePropTest extends KernelTestBase { 'adapter_matches_field_type' => [], 'adapter_matches_instance' => [], ], - '⿲sdc_test_all_props:all-props␟test-string-format-' . JsonSchemaStringFormat::URI->value => [ + '⿲sdc_test_all_props:all-props␟test_string_format_' . JsonSchemaStringFormat::URI->value => [ 'storage' => $all_string_storage_props, 'format_any_prop' => [ 'ℹ︎file_uri␟url', @@ -844,7 +844,7 @@ class SdcPropToFieldTypePropTest extends KernelTestBase { 'adapter_matches_field_type' => [], 'adapter_matches_instance' => [], ], - '⿲sdc_test_all_props:all-props␟test-string-format-' . JsonSchemaStringFormat::URI->value . '-image' => [ + '⿲sdc_test_all_props:all-props␟test_string_format_' . JsonSchemaStringFormat::URI->value . '_image' => [ 'storage' => $all_string_storage_props, 'format_any_prop' => [ 'ℹ︎image␟entity␜␜entity:file␝uri␞0␟url', @@ -877,7 +877,7 @@ class SdcPropToFieldTypePropTest extends KernelTestBase { ], ], ], - '⿲sdc_test_all_props:all-props␟test-string-format-' . JsonSchemaStringFormat::URI_REFERENCE->value => [ + '⿲sdc_test_all_props:all-props␟test_string_format_' . str_replace('-', '_', JsonSchemaStringFormat::URI_REFERENCE->value) => [ 'storage' => $all_string_storage_props, 'format_any_prop' => [ 'ℹ︎path␟alias', @@ -892,7 +892,7 @@ class SdcPropToFieldTypePropTest extends KernelTestBase { 'adapter_matches_field_type' => [], 'adapter_matches_instance' => [], ], - '⿲sdc_test_all_props:all-props␟test-string-format-' . JsonSchemaStringFormat::IRI->value => [ + '⿲sdc_test_all_props:all-props␟test_string_format_' . JsonSchemaStringFormat::IRI->value => [ 'storage' => $all_string_storage_props, 'format_any_prop' => [ 'ℹ︎file_uri␟url', @@ -922,7 +922,7 @@ class SdcPropToFieldTypePropTest extends KernelTestBase { 'adapter_matches_field_type' => [], 'adapter_matches_instance' => [], ], - '⿲sdc_test_all_props:all-props␟test-string-format-' . JsonSchemaStringFormat::IRI_REFERENCE->value => [ + '⿲sdc_test_all_props:all-props␟test_string_format_' . str_replace('-', '_', JsonSchemaStringFormat::IRI_REFERENCE->value) => [ 'storage' => $all_string_storage_props, 'format_any_prop' => [ 'ℹ︎path␟alias', @@ -937,7 +937,7 @@ class SdcPropToFieldTypePropTest extends KernelTestBase { 'adapter_matches_field_type' => [], 'adapter_matches_instance' => [], ], - '⿲sdc_test_all_props:all-props␟test-string-format-' . JsonSchemaStringFormat::URI_TEMPLATE->value => [ + '⿲sdc_test_all_props:all-props␟test_string_format_' . str_replace('-', '_', JsonSchemaStringFormat::URI_TEMPLATE->value) => [ 'storage' => $all_string_storage_props, 'format_any_prop' => [ // @todo Update \Drupal\sdc\Component\ComponentValidator to disallow this — does not make sense for presenting information? @@ -947,7 +947,7 @@ class SdcPropToFieldTypePropTest extends KernelTestBase { 'adapter_matches_field_type' => [], 'adapter_matches_instance' => [], ], - '⿲sdc_test_all_props:all-props␟test-string-format-' . JsonSchemaStringFormat::JSON_POINTER->value => [ + '⿲sdc_test_all_props:all-props␟test_string_format_' . str_replace('-', '_', JsonSchemaStringFormat::JSON_POINTER->value) => [ 'storage' => $all_string_storage_props, 'format_any_prop' => [ // @todo Update \Drupal\sdc\Component\ComponentValidator to disallow this — does not make sense for presenting information? @@ -957,7 +957,7 @@ class SdcPropToFieldTypePropTest extends KernelTestBase { 'adapter_matches_field_type' => [], 'adapter_matches_instance' => [], ], - '⿲sdc_test_all_props:all-props␟test-string-format-' . JsonSchemaStringFormat::RELATIVE_JSON_POINTER->value => [ + '⿲sdc_test_all_props:all-props␟test_string_format_' . str_replace('-', '_', JsonSchemaStringFormat::RELATIVE_JSON_POINTER->value) => [ 'storage' => $all_string_storage_props, 'format_any_prop' => [ // @todo Update \Drupal\sdc\Component\ComponentValidator to disallow this — does not make sense for presenting information? @@ -967,7 +967,7 @@ class SdcPropToFieldTypePropTest extends KernelTestBase { 'adapter_matches_field_type' => [], 'adapter_matches_instance' => [], ], - '⿲sdc_test_all_props:all-props␟test-string-format-' . JsonSchemaStringFormat::REGEX->value => [ + '⿲sdc_test_all_props:all-props␟test_string_format_' . JsonSchemaStringFormat::REGEX->value => [ 'storage' => $all_string_storage_props, 'format_any_prop' => [ // @todo Update \Drupal\sdc\Component\ComponentValidator to disallow this — does not make sense for presenting information? @@ -979,7 +979,7 @@ class SdcPropToFieldTypePropTest extends KernelTestBase { ], // Integers. - '⿲sdc_test_all_props:all-props␟test-integer' => [ + '⿲sdc_test_all_props:all-props␟test_integer' => [ 'storage' => $all_integer_storage_props, 'format_any_prop' => $all_integer_storage_props, 'format_main_prop' => [ @@ -1051,7 +1051,7 @@ class SdcPropToFieldTypePropTest extends KernelTestBase { 'adapter_matches_field_type' => [], 'adapter_matches_instance' => [], ], - '⿲sdc_test_all_props:all-props␟test-integer-range-minimum' => [ + '⿲sdc_test_all_props:all-props␟test_integer_range_minimum' => [ 'storage' => $all_integer_storage_props, 'format_any_prop' => [], 'format_main_prop' => [], @@ -1059,7 +1059,7 @@ class SdcPropToFieldTypePropTest extends KernelTestBase { 'adapter_matches_field_type' => [], 'adapter_matches_instance' => [], ], - '⿲sdc_test_all_props:all-props␟test-integer-range-minimum-maximum-timestamps' => [ + '⿲sdc_test_all_props:all-props␟test_integer_range_minimum_maximum_timestamps' => [ 'storage' => $all_integer_storage_props, 'format_any_prop' => [ 'ℹ︎timestamp␟value', @@ -1080,7 +1080,7 @@ class SdcPropToFieldTypePropTest extends KernelTestBase { 'adapter_matches_field_type' => [], 'adapter_matches_instance' => [], ], - '⿲sdc_test_all_props:all-props␟test-object-drupal-image' => [ + '⿲sdc_test_all_props:all-props␟test_object_drupal_image' => [ 'storage' => [ 'ℹ︎image␟{src↝entity␜␜entity:file␝uri␞0␟url,alt↠alt,width↠width,height↠height}', ], @@ -1114,7 +1114,7 @@ class SdcPropToFieldTypePropTest extends KernelTestBase { ], ], ], - '⿲sdc_test_all_props:all-props␟test-object-drupal-date-range' => [ + '⿲sdc_test_all_props:all-props␟test_object_drupal_date_range' => [ 'storage' => [ 'ℹ︎daterange␟{from↠end_value,to↠value}', ],