Security update for Core, with self-updated composer
[yaffs-website] / web / core / modules / content_moderation / tests / src / Kernel / EntityTypeInfoTest.php
1 <?php
2
3 namespace Drupal\Tests\content_moderation\Kernel;
4
5 use Drupal\content_moderation\Entity\Handler\ModerationHandler;
6 use Drupal\content_moderation\EntityTypeInfo;
7 use Drupal\KernelTests\KernelTestBase;
8
9 /**
10  * @coversDefaultClass \Drupal\content_moderation\EntityTypeInfo
11  *
12  * @group content_moderation
13  */
14 class EntityTypeInfoTest extends KernelTestBase {
15
16   /**
17    * Modules to enable.
18    *
19    * @var array
20    */
21   public static $modules = [
22     'content_moderation',
23     'workflows',
24     'entity_test',
25   ];
26
27   /**
28    * The entity type manager.
29    *
30    * @var \Drupal\Core\Entity\EntityTypeManagerInterface
31    */
32   protected $entityTypeManager;
33
34   /**
35    * The entity type info class.
36    *
37    * @var \Drupal\content_moderation\EntityTypeInfo
38    */
39   protected $entityTypeInfo;
40
41   /**
42    * {@inheritdoc}
43    */
44   protected function setUp() {
45     parent::setUp();
46     $this->entityTypeInfo = $this->container->get('class_resolver')->getInstanceFromDefinition(EntityTypeInfo::class);
47     $this->entityTypeManager = $this->container->get('entity_type.manager');
48   }
49
50   /**
51    * @covers ::entityBaseFieldInfo
52    */
53   public function testEntityBaseFieldInfo() {
54     $definition = $this->entityTypeManager->getDefinition('entity_test');
55     $definition->setHandlerClass('moderation', ModerationHandler::class);
56
57     $base_fields = $this->entityTypeInfo->entityBaseFieldInfo($definition);
58
59     $this->assertFalse($base_fields['moderation_state']->isReadOnly());
60     $this->assertTrue($base_fields['moderation_state']->isComputed());
61     $this->assertTrue($base_fields['moderation_state']->isTranslatable());
62   }
63
64 }