function ContentEntityNormalizerTest::createStubForContentEntity
Creates a stub content entity.
Parameters
array $definitions: The properties the will be returned.
Return value
\PHPUnit\Framework\MockObject\Stub The stub content entity.
2 calls to ContentEntityNormalizerTest::createStubForContentEntity()
- ContentEntityNormalizerTest::testNormalize in core/
modules/ serialization/ tests/ src/ Unit/ Normalizer/ ContentEntityNormalizerTest.php - Tests the normalize() method.
- ContentEntityNormalizerTest::testNormalizeWithAccountContext in core/
modules/ serialization/ tests/ src/ Unit/ Normalizer/ ContentEntityNormalizerTest.php - Tests the normalize() method with account context passed.
File
-
core/
modules/ serialization/ tests/ src/ Unit/ Normalizer/ ContentEntityNormalizerTest.php, line 134
Class
Namespace
Drupal\Tests\serialization\Unit\NormalizerCode
protected function createStubForContentEntity(array $definitions) : Stub {
$content_entity_mock = $this->createStub(ContentEntityBaseMockableClass::class);
$typed_data = $this->prophesize(ComplexDataInterface::class);
$typed_data->getProperties(TRUE)
->willReturn($definitions)
->shouldBeCalled();
$content_entity_mock->method('getTypedData')
->willReturn($typed_data->reveal());
return $content_entity_mock;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.