You are here

private function AccessibleTestingTrait::createAccessibleDouble in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/block_content/tests/src/Unit/Access/AccessibleTestingTrait.php \Drupal\Tests\block_content\Unit\Access\AccessibleTestingTrait::createAccessibleDouble()
  2. 10 core/modules/block_content/tests/src/Unit/Access/AccessibleTestingTrait.php \Drupal\Tests\block_content\Unit\Access\AccessibleTestingTrait::createAccessibleDouble()

Creates AccessibleInterface object from access result object for testing.

Parameters

\Drupal\Core\Access\AccessResultInterface $accessResult: The accessible result to return.

Return value

\Drupal\Core\Access\AccessibleInterface The AccessibleInterface object.

2 calls to AccessibleTestingTrait::createAccessibleDouble()
AccessGroupAndTest::testGroups in core/modules/block_content/tests/src/Unit/Access/AccessGroupAndTest.php
@covers \Drupal\block_content\Access\AccessGroupAnd
DependentAccessTest::setUp in core/modules/block_content/tests/src/Unit/Access/DependentAccessTest.php

File

core/modules/block_content/tests/src/Unit/Access/AccessibleTestingTrait.php, line 29

Class

AccessibleTestingTrait
Helper methods testing accessible interfaces.

Namespace

Drupal\Tests\block_content\Unit\Access

Code

private function createAccessibleDouble(AccessResultInterface $accessResult) {
  $accessible = $this
    ->prophesize(AccessibleInterface::class);
  $accessible
    ->access('view', $this->account, TRUE)
    ->willReturn($accessResult);
  return $accessible
    ->reveal();
}