function WorkspaceTest::testSpecialCharacters

Same name in other branches
  1. 9 core/modules/workspaces/tests/src/Functional/WorkspaceTest.php \Drupal\Tests\workspaces\Functional\WorkspaceTest::testSpecialCharacters()
  2. 8.9.x core/modules/workspaces/tests/src/Functional/WorkspaceTest.php \Drupal\Tests\workspaces\Functional\WorkspaceTest::testSpecialCharacters()
  3. 10 core/modules/workspaces/tests/src/Functional/WorkspaceTest.php \Drupal\Tests\workspaces\Functional\WorkspaceTest::testSpecialCharacters()

Tests creating a workspace with special characters.

File

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

Class

WorkspaceTest
Test the workspace entity.

Namespace

Drupal\Tests\workspaces\Functional

Code

public function testSpecialCharacters() : void {
    $this->drupalLogin($this->editor1);
    $page = $this->getSession()
        ->getPage();
    // Test a valid workspace name.
    $this->createAndActivateWorkspaceThroughUi('Workspace 1', 'workspace_1');
    $this->assertSession()
        ->elementTextContains('css', '.workspaces-toolbar-tab', 'Workspace 1');
    // Test and invalid workspace name.
    $this->drupalGet('/admin/config/workflow/workspaces/add');
    $this->assertSession()
        ->statusCodeEquals(200);
    $page->fillField('label', 'workspace2');
    $page->fillField('id', 'A!"£%^&*{}#~@?');
    $page->findButton('Save')
        ->click();
    $page->hasContent("This value is not valid");
}

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