public function WorkspaceTest::testWorkspaceToolbar in Drupal 8
Same name and namespace in other branches
- 9 core/modules/workspaces/tests/src/Functional/WorkspaceTest.php \Drupal\Tests\workspaces\Functional\WorkspaceTest::testWorkspaceToolbar()
 
Test that the toolbar correctly shows the active workspace.
File
- core/
modules/ workspaces/ tests/ src/ Functional/ WorkspaceTest.php, line 82  
Class
- WorkspaceTest
 - Test the workspace entity.
 
Namespace
Drupal\Tests\workspaces\FunctionalCode
public function testWorkspaceToolbar() {
  $this
    ->drupalLogin($this->editor1);
  $this
    ->drupalPostForm('/admin/config/workflow/workspaces/add', [
    'id' => 'test_workspace',
    'label' => 'Test workspace',
  ], 'Save');
  // Activate the test workspace.
  $this
    ->drupalPostForm('/admin/config/workflow/workspaces/manage/test_workspace/activate', [], 'Confirm');
  $this
    ->drupalGet('<front>');
  $page = $this
    ->getSession()
    ->getPage();
  // Toolbar should show the correct label.
  $this
    ->assertTrue($page
    ->hasLink('Test workspace'));
  // Change the workspace label.
  $this
    ->drupalPostForm('/admin/config/workflow/workspaces/manage/test_workspace/edit', [
    'label' => 'New name',
  ], 'Save');
  $this
    ->drupalGet('<front>');
  $page = $this
    ->getSession()
    ->getPage();
  // Toolbar should show the new label.
  $this
    ->assertTrue($page
    ->hasLink('New name'));
}