function WorkspaceTest::testNodeCreation

Same name and namespace in other branches
  1. main core/modules/workspaces/tests/src/Functional/WorkspaceTest.php \Drupal\Tests\workspaces\Functional\WorkspaceTest::testNodeCreation()

Tests that nodes created inside a workspace are assigned to the workspace.

File

core/modules/workspaces/tests/src/Functional/WorkspaceTest.php, line 418

Class

WorkspaceTest
Test the workspace entity.

Namespace

Drupal\Tests\workspaces\Functional

Code

public function testNodeCreation() : void {
  $this->createContentType([
    'type' => 'test',
    'label' => 'Test',
  ]);
  $this->drupalLogin($this->drupalCreateUser([
    'create workspace',
    'view own workspace',
    'create test content',
  ]));
  $workspace = $this->createAndActivateWorkspaceThroughUi('Test', 'test');
  $node = $this->createNodeThroughUi('Test', 'test');
  $this->assertSame($node->workspace->entity
    ->id(), $workspace->id());
}

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