function WorkspaceIntegrationTest::testPublishWorkspaceDedicatedTableStorage

Same name and namespace in other branches
  1. 9 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()
  3. 11.x core/modules/workspaces/tests/src/Kernel/WorkspaceIntegrationTest.php \Drupal\Tests\workspaces\Kernel\WorkspaceIntegrationTest::testPublishWorkspaceDedicatedTableStorage()

Test a deployment with fields in dedicated table storage.

File

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

Class

WorkspaceIntegrationTest
Tests a complete deployment 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);
}

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