Same name and namespace in other branches
- 8.9.x core/modules/serialization/tests/src/Unit/Normalizer/InternalTypedDataTestTrait.php \Drupal\Tests\serialization\Unit\Normalizer\InternalTypedDataTestTrait
- 9 core/modules/serialization/tests/src/Unit/Normalizer/InternalTypedDataTestTrait.php \Drupal\Tests\serialization\Unit\Normalizer\InternalTypedDataTestTrait
Trait that provides mocked typed data objects.
Hierarchy
- trait \Drupal\Tests\serialization\Unit\Normalizer\InternalTypedDataTestTrait
File
- core/
modules/ serialization/ tests/ src/ Unit/ Normalizer/ InternalTypedDataTestTrait.php, line 13
Namespace
Drupal\Tests\serialization\Unit\NormalizerView source
trait InternalTypedDataTestTrait {
/**
* Gets a typed data property.
*
* @param bool $internal
* Whether the typed data property is internal.
*
* @return \Drupal\Core\TypedData\TypedDataInterface
* The typed data property.
*/
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();
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
InternalTypedDataTestTrait:: |
protected | function | Gets a typed data property. |