function NodeTestBase::assertNodeCreateAccess

Same name in this branch
  1. 8.9.x core/modules/node/tests/src/Functional/NodeTestBase.php \Drupal\Tests\node\Functional\NodeTestBase::assertNodeCreateAccess()
Same name in other branches
  1. 9 core/modules/node/tests/src/Functional/NodeTestBase.php \Drupal\Tests\node\Functional\NodeTestBase::assertNodeCreateAccess()
  2. 10 core/modules/node/tests/src/Functional/NodeTestBase.php \Drupal\Tests\node\Functional\NodeTestBase::assertNodeCreateAccess()
  3. 11.x core/modules/node/tests/src/Functional/NodeTestBase.php \Drupal\Tests\node\Functional\NodeTestBase::assertNodeCreateAccess()

Asserts that node create access correctly grants or denies access.

Parameters

string $bundle: The node bundle to check access to.

bool $result: Whether access should be granted or not.

\Drupal\Core\Session\AccountInterface $account: The user account for which to check access.

string|null $langcode: (optional) The language code indicating which translation of the node to check. If NULL, the untranslated (fallback) access is checked.

File

core/modules/node/src/Tests/NodeTestBase.php, line 86

Class

NodeTestBase
Sets up page and article content types.

Namespace

Drupal\node\Tests

Code

public function assertNodeCreateAccess($bundle, $result, AccountInterface $account, $langcode = NULL) {
    $this->assertEqual($result, $this->accessHandler
        ->createAccess($bundle, $account, [
        'langcode' => $langcode,
    ]), $this->nodeAccessAssertMessage('create', $result, $langcode));
}

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