protected function setUp(): void
{ parent::
setUp();
$this->account =
$this->
prophesize(AccountInterface::
class)->
reveal();
} /**
* @covers \Drupal\block_content\Access\AccessGroupAnd
*/
public function testGroups() { $allowedAccessible =
$this->
createAccessibleDouble(AccessResult::
allowed());
$forbiddenAccessible =
$this->
createAccessibleDouble(AccessResult::
forbidden());
$neutralAccessible =
$this->
createAccessibleDouble(AccessResult::
neutral());
// Ensure that groups with no dependencies return a neutral access result.
$this->
assertTrue((new AccessGroupAnd())->
access('view',
$this->account, TRUE
)->
isNeutral());
$andNeutral =
new AccessGroupAnd();
$andNeutral->
addDependency($allowedAccessible)->
addDependency($neutralAccessible);
$this->
assertTrue($andNeutral->
access('view',
$this->account, TRUE
)->
isNeutral());
$andForbidden =
$andNeutral;