$expected =
in_array($operation,
$allow_operations);
$actual =
$this->accessControlHandler->
access($this->entity,
$operation,
$user);
$this->
assertSame($expected,
$actual, "Access problem with '
$operation' operation."
);
} } /**
* @covers ::access
* @covers ::checkAccess
*/
public function testAccess() { $this->
assertAllowOperations([],
$this->anon
);
$this->
assertAllowOperations(['view', 'update', 'delete'
],
$this->member
);
$this->
assertAllowOperations(['view', 'update', 'delete'
],
$this->parentMember
);
$this->entity->
enforceIsNew(TRUE
)->
save();
// Unfortunately, EntityAccessControlHandler has a static cache, which we
// therefore must reset manually.
$this->accessControlHandler->
resetCache();
$this->
assertAllowOperations([],
$this->anon
);
$this->
assertAllowOperations(['view', 'update'
],
$this->member
);
$this->
assertAllowOperations(['view', 'update'
],
$this->parentMember
);
}