You are here

function NodeTestBase::nodeAccessAssertMessage 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::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 NodeTestBase::nodeAccessAssertMessage()
NodeTestBase::assertNodeAccess in core/modules/node/src/Tests/NodeTestBase.php
Asserts that node access correctly grants or denies access.
NodeTestBase::assertNodeCreateAccess in core/modules/node/src/Tests/NodeTestBase.php
Asserts that node create access correctly grants or denies access.

File

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

Class

NodeTestBase
Sets up page and article content types.

Namespace

Drupal\node\Tests

Code

function nodeAccessAssertMessage($operation, $result, $langcode = NULL) {
  return format_string('Node access returns @result with operation %op, language code %langcode.', array(
    '@result' => $result ? 'true' : 'false',
    '%op' => $operation,
    '%langcode' => !empty($langcode) ? $langcode : 'empty',
  ));
}