You are here

protected function InternalTypedDataTestTrait::getTypedDataProperty in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/serialization/tests/src/Unit/Normalizer/InternalTypedDataTestTrait.php \Drupal\Tests\serialization\Unit\Normalizer\InternalTypedDataTestTrait::getTypedDataProperty()
  2. 9 core/modules/serialization/tests/src/Unit/Normalizer/InternalTypedDataTestTrait.php \Drupal\Tests\serialization\Unit\Normalizer\InternalTypedDataTestTrait::getTypedDataProperty()

Gets a typed data property.

Parameters

bool $internal: Whether the typed data property is internal.

Return value

\Drupal\Core\TypedData\TypedDataInterface The typed data property.

5 calls to InternalTypedDataTestTrait::getTypedDataProperty()
ComplexDataNormalizerTest::testNormalizeComplexData in core/modules/serialization/tests/src/Unit/Normalizer/ComplexDataNormalizerTest.php
Tests normalizing complex data.
EntityReferenceFieldItemNormalizerTest::testNormalize in core/modules/serialization/tests/src/Unit/Normalizer/EntityReferenceFieldItemNormalizerTest.php
@covers ::normalize
EntityReferenceFieldItemNormalizerTest::testNormalizeWithEmptyTaxonomyTermReference in core/modules/serialization/tests/src/Unit/Normalizer/EntityReferenceFieldItemNormalizerTest.php
@covers ::normalize
EntityReferenceFieldItemNormalizerTest::testNormalizeWithNewEntityReference in core/modules/serialization/tests/src/Unit/Normalizer/EntityReferenceFieldItemNormalizerTest.php
EntityReferenceFieldItemNormalizerTest::testNormalizeWithNoEntity in core/modules/serialization/tests/src/Unit/Normalizer/EntityReferenceFieldItemNormalizerTest.php
@covers ::normalize

File

core/modules/serialization/tests/src/Unit/Normalizer/InternalTypedDataTestTrait.php, line 22

Class

InternalTypedDataTestTrait
Trait that provides mocked typed data objects.

Namespace

Drupal\Tests\serialization\Unit\Normalizer

Code

protected function getTypedDataProperty($internal = TRUE) {
  $definition = $this
    ->prophesize(DataDefinitionInterface::class);
  $definition
    ->isInternal()
    ->willReturn($internal)
    ->shouldBeCalled();
  $definition = $definition
    ->reveal();
  $property = $this
    ->prophesize(TypedDataInterface::class);
  $property
    ->getDataDefinition()
    ->willReturn($definition)
    ->shouldBeCalled();
  return $property
    ->reveal();
}