public function PaymentMethodConfigurationAccessControlHandlerTest::testCheckAccessWithAnyPermission in Payment 8.2
@covers ::checkAccess
File
- tests/
src/ Unit/ Entity/ PaymentMethodConfiguration/ PaymentMethodConfigurationAccessControlHandlerTest.php, line 120
Class
- PaymentMethodConfigurationAccessControlHandlerTest
- @coversDefaultClass \Drupal\payment\Entity\PaymentMethodConfiguration\PaymentMethodConfigurationAccessControlHandler
Namespace
Drupal\Tests\payment\Unit\Entity\PaymentMethodConfigurationCode
public function testCheckAccessWithAnyPermission() {
$operation = $this
->randomMachineName();
$account = $this
->createMock(AccountInterface::class);
$map = [
[
'payment.payment_method_configuration.' . $operation . '.any',
TRUE,
],
[
'payment.payment_method_configuration.' . $operation . '.own',
FALSE,
],
];
$account
->expects($this
->any())
->method('hasPermission')
->willReturnMap($map);
$payment_method_configuration = $this
->getMockPaymentMethodConfiguration();
$class = new \ReflectionClass($this->sut);
$method = $class
->getMethod('checkAccess');
$method
->setAccessible(TRUE);
$this
->assertTrue($method
->invokeArgs($this->sut, [
$payment_method_configuration,
$operation,
$account,
])
->isAllowed());
}