trait AccessibleTestingTrait in Drupal 10
Same name and namespace in other branches
- 8 core/modules/block_content/tests/src/Unit/Access/AccessibleTestingTrait.php \Drupal\Tests\block_content\Unit\Access\AccessibleTestingTrait
- 9 core/modules/block_content/tests/src/Unit/Access/AccessibleTestingTrait.php \Drupal\Tests\block_content\Unit\Access\AccessibleTestingTrait
Helper methods testing accessible interfaces.
Hierarchy
- trait \Drupal\Tests\block_content\Unit\Access\AccessibleTestingTrait
File
- core/
modules/ block_content/ tests/ src/ Unit/ Access/ AccessibleTestingTrait.php, line 11
Namespace
Drupal\Tests\block_content\Unit\AccessView source
trait AccessibleTestingTrait {
/**
* The test account.
*
* @var \Drupal\Core\Session\AccountInterface
*/
protected $account;
/**
* Creates AccessibleInterface object from access result object for testing.
*
* @param \Drupal\Core\Access\AccessResultInterface $accessResult
* The accessible result to return.
*
* @return \Drupal\Core\Access\AccessibleInterface
* The AccessibleInterface object.
*/
private function createAccessibleDouble(AccessResultInterface $accessResult) {
$accessible = $this
->prophesize(AccessibleInterface::class);
$accessible
->access('view', $this->account, TRUE)
->willReturn($accessResult);
return $accessible
->reveal();
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
AccessibleTestingTrait:: |
protected | property | The test account. | |
AccessibleTestingTrait:: |
private | function | Creates AccessibleInterface object from access result object for testing. |