diff --git a/core/modules/system/tests/modules/entity_test/src/Plugin/DataType/ComputedString.php b/core/modules/system/tests/modules/entity_test/src/Plugin/DataType/ComputedString.php deleted file mode 100644 index a3b77aeed9..0000000000 --- a/core/modules/system/tests/modules/entity_test/src/Plugin/DataType/ComputedString.php +++ /dev/null @@ -1,39 +0,0 @@ -sourceString = $not_computed_value; - } - - /** - * {@inheritdoc} - */ - public function __toString() { - // Computation is simple concatenation for test. - return "Computed! " . $this->sourceString; - } - -} diff --git a/core/modules/system/tests/modules/entity_test/src/Plugin/DataType/ComputedStringData.php b/core/modules/system/tests/modules/entity_test/src/Plugin/DataType/ComputedStringData.php deleted file mode 100644 index b13d0d72c5..0000000000 --- a/core/modules/system/tests/modules/entity_test/src/Plugin/DataType/ComputedStringData.php +++ /dev/null @@ -1,34 +0,0 @@ -getParent(); - $computed = new ComputedString($item->get('value')->getString()); - return $computed; - } - - /** - * {@inheritdoc} - */ - public function getCastedValue() { - return (string) $this->getValue(); - } - -} diff --git a/core/modules/system/tests/modules/entity_test/src/Plugin/Field/FieldType/InternalPropertyTestFieldItem.php b/core/modules/system/tests/modules/entity_test/src/Plugin/Field/FieldType/InternalPropertyTestFieldItem.php index 5fa17e10e4..b981339efa 100644 --- a/core/modules/system/tests/modules/entity_test/src/Plugin/Field/FieldType/InternalPropertyTestFieldItem.php +++ b/core/modules/system/tests/modules/entity_test/src/Plugin/Field/FieldType/InternalPropertyTestFieldItem.php @@ -6,7 +6,7 @@ use Drupal\Core\Field\Plugin\Field\FieldType\StringItem; use Drupal\Core\StringTranslation\TranslatableMarkup; use Drupal\Core\TypedData\DataDefinition; -use Drupal\entity_test\Plugin\DataType\ComputedStringData; +use Drupal\entity_test\TypedData\ComputedString; /** * Defines the 'Internal Property' entity test field type. @@ -29,16 +29,16 @@ public static function propertyDefinitions(FieldStorageDefinitionInterface $fiel $properties = parent::propertyDefinitions($field_definition); // Add a computed property that is non-internal. - $properties['non_internal_value'] = DataDefinition::create('computed_string_test') + $properties['non_internal_value'] = DataDefinition::create('string') ->setLabel(new TranslatableMarkup('Computed string, non-internal')) ->setComputed(TRUE) - ->setClass(ComputedStringData::class) + ->setClass(ComputedString::class) ->setInternal(FALSE); // Add a computed property that is internal. - $properties['internal_value'] = DataDefinition::create('computed_string_test') + $properties['internal_value'] = DataDefinition::create('string') ->setLabel(new TranslatableMarkup('Computed string, internal')) ->setComputed(TRUE) - ->setClass(ComputedStringData::class); + ->setClass(ComputedString::class); return $properties; } diff --git a/core/modules/system/tests/modules/entity_test/src/TypedData/ComputedString.php b/core/modules/system/tests/modules/entity_test/src/TypedData/ComputedString.php new file mode 100644 index 0000000000..121699c807 --- /dev/null +++ b/core/modules/system/tests/modules/entity_test/src/TypedData/ComputedString.php @@ -0,0 +1,30 @@ +getParent(); + $computed_value = "Computed! " . $item->get('value')->getString(); + + return $computed_value; + } + + /** + * {@inheritdoc} + */ + public function getCastedValue() { + return $this->getString(); + } + +}