protected function InternalTypedDataTestTrait::getTypedDataProperty in Drupal 9
Same name and namespace in other branches
- 8 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.
1 call to InternalTypedDataTestTrait::getTypedDataProperty()
- ComplexDataNormalizerTest::testNormalizeComplexData in core/
modules/ serialization/ tests/ src/ Unit/ Normalizer/ ComplexDataNormalizerTest.php - Tests 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\NormalizerCode
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();
}