You are here

public function NodeTestBase::assertNodeCreateAccess in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/node/tests/src/Functional/NodeTestBase.php \Drupal\Tests\node\Functional\NodeTestBase::assertNodeCreateAccess()
  2. 9 core/modules/node/tests/src/Functional/NodeTestBase.php \Drupal\Tests\node\Functional\NodeTestBase::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.

File

core/modules/node/tests/src/Functional/NodeTestBase.php, line 83

Class

NodeTestBase
Sets up page and article content types.

Namespace

Drupal\Tests\node\Functional

Code

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