You are here

function NodeTestBase::assertNodeCreateAccess in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/node/src/Tests/NodeTestBase.php \Drupal\node\Tests\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.

1 call to NodeTestBase::assertNodeCreateAccess()
NodeAccessTest::testNodeAccess in core/modules/node/src/Tests/NodeAccessTest.php
Runs basic tests for node_access function.

File

core/modules/node/src/Tests/NodeTestBase.php, line 83
Contains \Drupal\node\Tests\NodeTestBase.

Class

NodeTestBase
Sets up page and article content types.

Namespace

Drupal\node\Tests

Code

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