You are here

public function WorkspaceTest::testSpecialCharacters in Drupal 9

Same name and namespace in other branches
  1. 8 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 76

Class

WorkspaceTest
Test the workspace entity.

Namespace

Drupal\Tests\workspaces\Functional

Code

public function testSpecialCharacters() {
  $this
    ->drupalLogin($this->editor1);

  // Test a valid workspace name.
  $this
    ->createWorkspaceThroughUi('Workspace 1', 'a0_$()+-/');

  // Test and invalid workspace name.
  $this
    ->drupalGet('/admin/config/workflow/workspaces/add');
  $this
    ->assertSession()
    ->statusCodeEquals(200);
  $page = $this
    ->getSession()
    ->getPage();
  $page
    ->fillField('label', 'workspace2');
  $page
    ->fillField('id', 'A!"£%^&*{}#~@?');
  $page
    ->findButton('Save')
    ->click();
  $page
    ->hasContent("This value is not valid");
}