function NodeAccessTestBase::nodeAccessAssertMessage

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

Constructs an assert message to display which node access was tested.

Parameters

string $operation: The operation to check access for.

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

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

Return value

string An assert message string which contains information in plain English about the node access permission test that was performed.

2 calls to NodeAccessTestBase::nodeAccessAssertMessage()
NodeAccessTestBase::assertNodeAccess in core/modules/node/tests/src/Kernel/NodeAccessTestBase.php
Asserts that node access correctly grants or denies access.
NodeAccessTestBase::assertNodeCreateAccess in core/modules/node/tests/src/Kernel/NodeAccessTestBase.php
Asserts that node create access correctly grants or denies access.

File

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

Class

NodeAccessTestBase
Defines a base class for node access kernel tests.

Namespace

Drupal\Tests\node\Kernel

Code

public function nodeAccessAssertMessage($operation, $result, $langcode = NULL) {
    return sprintf('Node access returns %s with operation %s, language code %s.', $result ? 'true' : 'false', $operation, !empty($langcode) ? $langcode : 'empty');
}

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