setupModerationBundleInfo example

$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();
  }

  /** * @covers ::isModeratedEntityType */
  public function testIsModeratedEntityType() {
    $moderation_information = new ModerationInformation($this->getEntityTypeManager()$this->setupModerationBundleInfo('test_bundle', 'workflow'));

    $moderated_entity_type = $this->prophesize(EntityTypeInterface::class);
    $moderated_entity_type->id()->willReturn('test_entity_type');

    $unmoderated_entity_type = $this->prophesize(EntityTypeInterface::class);
    $unmoderated_entity_type->id()->willReturn('unmoderated_test_type');

    $this->assertTrue($moderation_information->isModeratedEntityType($moderated_entity_type->reveal()));
    $this->assertFalse($moderation_information->isModeratedEntityType($unmoderated_entity_type->reveal()));
  }

  
Home | Imprint | This part of the site doesn't use cookies.