You are here

protected function WorkspaceTestUtilities::createNodeThroughUI in Workspace 8

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

Creates a node by "clicking" buttons.

Parameters

string $label:

string $bundle:

Return value

\Drupal\multiversion\Entity\WorkspaceInterface

Throws

\Behat\Mink\Exception\ElementNotFoundException

3 calls to WorkspaceTestUtilities::createNodeThroughUI()
EntityTypeAlterTest::testTree in tests/src/Functional/EntityTypeAlterTest.php
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.

File

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

Class

WorkspaceTestUtilities
Utility methods for use in BrowserTestBase tests.

Namespace

Drupal\Tests\workspace\Functional

Code

protected function createNodeThroughUI($label, $bundle) {
  $this
    ->drupalGet('/node/add/' . $bundle);
  $session = $this
    ->getSession();
  $this
    ->assertSession()
    ->statusCodeEquals(200);
  $page = $session
    ->getPage();
  $page
    ->fillField('Title', $label);
  $page
    ->findButton(t('Save'))
    ->click();
  $session
    ->getPage()
    ->hasContent("{$label} has been created");
  return $this
    ->getOneEntityByLabel('node', $label);
}