You are here

public function WorkspaceIntegrationTest::testPublishWorkspaceDedicatedTableStorage in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/workspaces/tests/src/Kernel/WorkspaceIntegrationTest.php \Drupal\Tests\workspaces\Kernel\WorkspaceIntegrationTest::testPublishWorkspaceDedicatedTableStorage()
  2. 10 core/modules/workspaces/tests/src/Kernel/WorkspaceIntegrationTest.php \Drupal\Tests\workspaces\Kernel\WorkspaceIntegrationTest::testPublishWorkspaceDedicatedTableStorage()

Tests publishing with fields in dedicated table storage.

File

core/modules/workspaces/tests/src/Kernel/WorkspaceIntegrationTest.php, line 1010

Class

WorkspaceIntegrationTest
Tests a complete publishing scenario across different workspaces.

Namespace

Drupal\Tests\workspaces\Kernel

Code

public function testPublishWorkspaceDedicatedTableStorage() {
  $this
    ->initializeWorkspacesModule();
  $node_storage = $this->entityTypeManager
    ->getStorage('node');
  $this->workspaceManager
    ->switchToLive();
  $node = $node_storage
    ->create([
    'title' => 'Foo title',
    // Use the body field on node as a test case because it requires dedicated
    // table storage.
    'body' => 'Foo body',
    'type' => 'page',
  ]);
  $node
    ->save();
  $this
    ->switchToWorkspace('stage');
  $node->title = 'Bar title';
  $node->body = 'Bar body';
  $node
    ->save();
  $this->workspaces['stage']
    ->publish();
  $this->workspaceManager
    ->switchToLive();
  $reloaded = $node_storage
    ->load($node
    ->id());
  $this
    ->assertEquals('Bar title', $reloaded->title->value);
  $this
    ->assertEquals('Bar body', $reloaded->body->value);
}