You are here

public function WorkspaceTest::testSpecialCharacters in Workspace 8

Same name and namespace in other branches
  1. 8.2 tests/src/Functional/WorkspaceTest.php \Drupal\Tests\workspace\Functional\WorkspaceTest::testSpecialCharacters()

Tests machine names allow the same characters as CouchDB does.

File

tests/src/Functional/WorkspaceTest.php, line 38

Class

WorkspaceTest
Test the workspace entity.

Namespace

Drupal\Tests\workspace\Functional

Code

public function testSpecialCharacters() {

  // Test a valid workspace name
  $this
    ->createWorkspaceThroughUI('Workspace 1', 'a0_b1_');

  // Test and invaid workspace name
  $this
    ->drupalGet('/admin/structure/workspace/add');
  $session = $this
    ->getSession();
  $this
    ->assertEquals(200, $session
    ->getStatusCode());
  $page = $session
    ->getPage();
  $page
    ->fillField('label', 'workspace2');
  $page
    ->fillField('machine_name', 'A!"£%^&*{}#~@?');
  $page
    ->findButton(t('Save'))
    ->click();
  $session
    ->getPage()
    ->hasContent("This value is not valid");
}