function NodeAccessTestBase::assertNodeCreateAccess

Same name in other branches
  1. 9 core/modules/node/tests/src/Kernel/NodeAccessTestBase.php \Drupal\Tests\node\Kernel\NodeAccessTestBase::assertNodeCreateAccess()
  2. 8.9.x core/modules/node/tests/src/Kernel/NodeAccessTestBase.php \Drupal\Tests\node\Kernel\NodeAccessTestBase::assertNodeCreateAccess()
  3. 11.x core/modules/node/tests/src/Kernel/NodeAccessTestBase.php \Drupal\Tests\node\Kernel\NodeAccessTestBase::assertNodeCreateAccess()

Asserts that node create access correctly grants or denies access.

@internal

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 NodeAccessTestBase::assertNodeCreateAccess()
NodeAccessTest::testNodeAccess in core/modules/node/tests/src/Kernel/NodeAccessTest.php
Runs basic tests for node_access function.

File

core/modules/node/tests/src/Kernel/NodeAccessTestBase.php, line 119

Class

NodeAccessTestBase
Defines a base class for node access kernel tests.

Namespace

Drupal\Tests\node\Kernel

Code

public function assertNodeCreateAccess(string $bundle, bool $result, AccountInterface $account, ?string $langcode = NULL) {
    $this->assertEquals($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.