function ModerationInformationTest::setupModerationBundleInfo
Same name in other branches
- 9 core/modules/content_moderation/tests/src/Unit/ModerationInformationTest.php \Drupal\Tests\content_moderation\Unit\ModerationInformationTest::setupModerationBundleInfo()
- 8.9.x core/modules/content_moderation/tests/src/Unit/ModerationInformationTest.php \Drupal\Tests\content_moderation\Unit\ModerationInformationTest::setupModerationBundleInfo()
- 11.x core/modules/content_moderation/tests/src/Unit/ModerationInformationTest.php \Drupal\Tests\content_moderation\Unit\ModerationInformationTest::setupModerationBundleInfo()
Sets up content moderation and entity type bundle info mocking.
Parameters
string $bundle: The bundle ID.
string|null $workflow: The workflow ID. If nul no workflow information is added to the bundle.
Return value
\Drupal\Core\Entity\EntityTypeManagerInterface The mocked entity type manager.
4 calls to ModerationInformationTest::setupModerationBundleInfo()
- ModerationInformationTest::testGetWorkflowForEntity in core/
modules/ content_moderation/ tests/ src/ Unit/ ModerationInformationTest.php - @dataProvider providerWorkflow @covers ::getWorkflowForEntity
- ModerationInformationTest::testIsModeratedEntity in core/
modules/ content_moderation/ tests/ src/ Unit/ ModerationInformationTest.php - @dataProvider providerWorkflow @covers ::isModeratedEntity
- ModerationInformationTest::testIsModeratedEntityType in core/
modules/ content_moderation/ tests/ src/ Unit/ ModerationInformationTest.php - @covers ::isModeratedEntityType
- ModerationInformationTest::testShouldModerateEntities in core/
modules/ content_moderation/ tests/ src/ Unit/ ModerationInformationTest.php - @dataProvider providerWorkflow @covers ::shouldModerateEntitiesOfBundle
File
-
core/
modules/ content_moderation/ tests/ src/ Unit/ ModerationInformationTest.php, line 59
Class
- ModerationInformationTest
- @coversDefaultClass \Drupal\content_moderation\ModerationInformation @group content_moderation
Namespace
Drupal\Tests\content_moderation\UnitCode
public function setupModerationBundleInfo($bundle, $workflow = NULL) {
$bundle_info_array = [];
if ($workflow) {
$bundle_info_array['workflow'] = $workflow;
}
$bundle_info = $this->prophesize(EntityTypeBundleInfoInterface::class);
$bundle_info->getBundleInfo("test_entity_type")
->willReturn([
$bundle => $bundle_info_array,
]);
$bundle_info->getBundleInfo("unmoderated_test_type")
->willReturn([
$bundle => [],
]);
return $bundle_info->reveal();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.