function EntityTypeInfoTest::testEntityBaseFieldInfo

Same name in other branches
  1. 9 core/modules/content_moderation/tests/src/Kernel/EntityTypeInfoTest.php \Drupal\Tests\content_moderation\Kernel\EntityTypeInfoTest::testEntityBaseFieldInfo()
  2. 10 core/modules/content_moderation/tests/src/Kernel/EntityTypeInfoTest.php \Drupal\Tests\content_moderation\Kernel\EntityTypeInfoTest::testEntityBaseFieldInfo()
  3. 11.x core/modules/content_moderation/tests/src/Kernel/EntityTypeInfoTest.php \Drupal\Tests\content_moderation\Kernel\EntityTypeInfoTest::testEntityBaseFieldInfo()

@covers ::entityBaseFieldInfo

File

core/modules/content_moderation/tests/src/Kernel/EntityTypeInfoTest.php, line 68

Class

EntityTypeInfoTest
@coversDefaultClass \Drupal\content_moderation\EntityTypeInfo

Namespace

Drupal\Tests\content_moderation\Kernel

Code

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.