function 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.

1 call to InternalTypedDataTestTrait::getTypedDataProperty()
ComplexDataNormalizerTest::testNormalizeComplexData in core/modules/serialization/tests/src/Unit/Normalizer/ComplexDataNormalizerTest.php
Test normalizing complex data.

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();
}

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