protected function ModerationDeriverTest::mockEntityType in Workbench Moderation to Content Moderation 8.2
Mocks an entity type definition based on flags from the data provider.
Parameters
bool[] $flags: Boolean flags that determine the behavior of the mocked entity type. They represent revisionability and translatability, in that order.
Return value
\Drupal\Core\Entity\ContentEntityTypeInterface The mocked entity type definition.
1 call to ModerationDeriverTest::mockEntityType()
- ModerationDeriverTest::testGetDerivativeDefinitions in tests/
src/ Unit/ Plugin/ Deriver/ ModerationDeriverTest.php - @covers ::getDerivativeDefinitions
File
- tests/
src/ Unit/ Plugin/ Deriver/ ModerationDeriverTest.php, line 70
Class
- ModerationDeriverTest
- @coversDefaultClass \Drupal\wbm2cm\Plugin\Deriver\ModerationDeriver @group wbm2cm
Namespace
Drupal\Tests\wbm2cm\Unit\Plugin\DeriverCode
protected function mockEntityType(array $flags, $entity_type_id = NULL) {
list($revisionable, $translatable) = $flags;
$entity_type = $this
->prophesize(ContentEntityTypeInterface::class);
$entity_type
->id()
->willReturn($entity_type_id ?: $this
->randomMachineName());
$entity_type
->getProvider()
->willReturn('wbm2cm');
$entity_type
->isRevisionable()
->willReturn((bool) $revisionable);
$entity_type
->isTranslatable()
->willReturn((bool) $translatable);
return $entity_type
->reveal();
}