public function WorkspaceIntegrationTest::testPublishWorkspaceDedicatedTableStorage in Drupal 10
Same name and namespace in other branches
- 8 core/modules/workspaces/tests/src/Kernel/WorkspaceIntegrationTest.php \Drupal\Tests\workspaces\Kernel\WorkspaceIntegrationTest::testPublishWorkspaceDedicatedTableStorage()
- 9 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 1025
Class
- WorkspaceIntegrationTest
- Tests a complete publishing scenario across different workspaces.
Namespace
Drupal\Tests\workspaces\KernelCode
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);
}