trait InternalTypedDataTestTrait
Same name in other branches
- 9 core/modules/serialization/tests/src/Unit/Normalizer/InternalTypedDataTestTrait.php \Drupal\Tests\serialization\Unit\Normalizer\InternalTypedDataTestTrait
- 8.9.x core/modules/serialization/tests/src/Unit/Normalizer/InternalTypedDataTestTrait.php \Drupal\Tests\serialization\Unit\Normalizer\InternalTypedDataTestTrait
- 10 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
Title Sort descending | Modifiers | Object type | Summary |
---|---|---|---|
InternalTypedDataTestTrait::getTypedDataProperty | protected | function | Gets a typed data property. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.