You are here

protected function WorkspaceTestUtilities::createWorkspaceThroughUI in Workspace 8

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

Creates a new Workspace through the UI.

Parameters

string $label: The label of the workspace to create.

string $machine_name: The machine name of the workspace to create.

Return value

\Drupal\multiversion\Entity\WorkspaceInterface The workspace that was just created.

Throws

\Behat\Mink\Exception\ElementNotFoundException

14 calls to WorkspaceTestUtilities::createWorkspaceThroughUI()
ReplicatorAliasTest::testReplicationAlias in tests/src/Functional/ReplicatorAliasTest.php
Verifies that a user can edit anything in a workspace with a specific perm.
ReplicatorTest::testReplication in tests/src/Functional/ReplicatorTest.php
Test replication.
ReplicatorTest::testSelectiveContentReplication in tests/src/Functional/ReplicatorTest.php
Test selective content replication.
WorkspaceBypassTest::testBypassOwnWorkspace in tests/src/Functional/WorkspaceBypassTest.php
Verifies that a user can edit anything in a workspace they own.
WorkspaceBypassTest::testBypassSpecificWorkspace in tests/src/Functional/WorkspaceBypassTest.php
Verifies that a user can edit anything in a workspace with a specific perm.

... See full list

File

tests/src/Functional/WorkspaceTestUtilities.php, line 78

Class

WorkspaceTestUtilities
Utility methods for use in BrowserTestBase tests.

Namespace

Drupal\Tests\workspace\Functional

Code

protected function createWorkspaceThroughUI($label, $machine_name) {
  $this
    ->drupalGet('/admin/structure/workspace/add');
  $session = $this
    ->getSession();
  $this
    ->assertSession()
    ->statusCodeEquals(200);
  $page = $session
    ->getPage();
  $page
    ->fillField('label', $label);
  $page
    ->fillField('machine_name', $machine_name);
  $page
    ->findButton(t('Save'))
    ->click();
  $session
    ->getPage()
    ->hasContent("{$label} ({$machine_name})");
  return $this
    ->getOneWorkspaceByLabel($label);
}