You are here

public function IngredientAccessTest::accessAssertMessage in Recipe 8.2

Constructs an assert message to display which ingredient 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 ingredient 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 ingredient access permission test that was performed.

2 calls to IngredientAccessTest::accessAssertMessage()
IngredientAccessTest::assertIngredientAccess in modules/ingredient/tests/src/Kernel/IngredientAccessTest.php
Asserts that Ingredient access correctly grants or denies access.
IngredientAccessTest::assertIngredientCreateAccess in modules/ingredient/tests/src/Kernel/IngredientAccessTest.php
Asserts that ingredient create access correctly grants or denies access.

File

modules/ingredient/tests/src/Kernel/IngredientAccessTest.php, line 149

Class

IngredientAccessTest
@coversDefaultClass \Drupal\ingredient\IngredientAccessControlHandler

Namespace

Drupal\Tests\ingredient\Kernel

Code

public function accessAssertMessage($operation, $result, $langcode = NULL) {
  return new FormattableMarkup('Ingredient access returns @result with operation %op, language code %langcode.', [
    '@result' => $result ? 'true' : 'false',
    '%op' => $operation,
    '%langcode' => !empty($langcode) ? $langcode : 'empty',
  ]);
}