entityBaseFieldInfo example

$this->installConfig(['content_moderation']);
  }

  /** * @covers ::entityBaseFieldInfo */
  public function testEntityBaseFieldInfo() {
    $definition = $this->entityTypeManager->getDefinition('entity_test');
    $definition->setHandlerClass('moderation', ModerationHandler::class);

    $this->enableModeration('entity_test', 'entity_test');
    $base_fields = $this->entityTypeInfo->entityBaseFieldInfo($definition);

    $this->assertFalse($base_fields['moderation_state']->isReadOnly());
    $this->assertTrue($base_fields['moderation_state']->isComputed());
    $this->assertTrue($base_fields['moderation_state']->isTranslatable());
  }

  /** * Tests the correct entity types have moderation added. * * @covers ::entityTypeAlter * * @dataProvider providerTestEntityTypeAlter */
Home | Imprint | This part of the site doesn't use cookies.