diff --git a/core/modules/content_moderation/tests/src/Kernel/ContentModerationStateStorageSchemaTest.php b/core/modules/content_moderation/tests/src/Kernel/ContentModerationStateStorageSchemaTest.php index af59651..38de772 100644 --- a/core/modules/content_moderation/tests/src/Kernel/ContentModerationStateStorageSchemaTest.php +++ b/core/modules/content_moderation/tests/src/Kernel/ContentModerationStateStorageSchemaTest.php @@ -2,6 +2,8 @@ namespace Drupal\Tests\content_moderation\Kernel; +use Drupal\block_content\Entity\BlockContent; +use Drupal\block_content\Entity\BlockContentType; use Drupal\content_moderation\Entity\ContentModerationState; use Drupal\KernelTests\KernelTestBase; use Drupal\node\Entity\Node; @@ -26,7 +28,7 @@ class ContentModerationStateStorageSchemaTest extends KernelTestBase { 'system', 'text', 'workflows', - 'entity_test', + 'block_content', ]; /** @@ -37,7 +39,7 @@ protected function setUp() { $this->installSchema('node', 'node_access'); $this->installEntitySchema('node'); - $this->installEntitySchema('entity_test'); + $this->installEntitySchema('block_content'); $this->installEntitySchema('user'); $this->installEntitySchema('content_moderation_state'); $this->installConfig('content_moderation'); @@ -45,8 +47,15 @@ protected function setUp() { NodeType::create([ 'type' => 'example', ])->save(); + + BlockContentType::create([ + 'label' => 'Test', + 'id' => 'example', + ])->save(); + $workflow = Workflow::load('editorial'); $workflow->getTypePlugin()->addEntityTypeAndBundle('node', 'example'); + $workflow->getTypePlugin()->addEntityTypeAndBundle('block_content', 'example'); $workflow->save(); } @@ -88,18 +97,22 @@ public function testUniqueKeys() { ], FALSE); // Different entity types should not trigger an exception. - $this->assertStorageException([ - 'content_entity_type_id' => 'entity_test', - 'content_entity_id' => $node->id(), - 'content_entity_revision_id' => $node->getRevisionId(), - ], FALSE); + $block_content = BlockContent::create([ + 'info' => 'Test block', + 'type' => 'example', + 'moderation_state' => 'draft', + ]); + $block_content->save(); + $this->assertEquals($block_content->id(), $node->id()); + $this->assertEquals($block_content->getRevisionId(), $node->getRevisionId()); // Different entity and revision IDs should not trigger an exception. - $this->assertStorageException([ - 'content_entity_type_id' => $node->getEntityTypeId(), - 'content_entity_id' => 9999, - 'content_entity_revision_id' => 9999, - ], FALSE); + $second_node = Node::create([ + 'title' => 'Test title', + 'type' => 'example', + 'moderation_state' => 'draft', + ]); + $second_node->save(); // Creating a version of the entity with a previously used, but not current // revision ID should trigger an exception.