function AccessibleTestingTrait::createAccessibleDouble

Same name in other branches
  1. 9 core/modules/block_content/tests/src/Unit/Access/AccessibleTestingTrait.php \Drupal\Tests\block_content\Unit\Access\AccessibleTestingTrait::createAccessibleDouble()
  2. 8.9.x core/modules/block_content/tests/src/Unit/Access/AccessibleTestingTrait.php \Drupal\Tests\block_content\Unit\Access\AccessibleTestingTrait::createAccessibleDouble()
  3. 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 31

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();
}

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