MenuLinkContentAccessControlHandler example

$language->expects($this->any())
      ->method('getId')
      ->willReturn('de');

    $entity = $this->createMock(ContentEntityInterface::class);
    $entity->expects($this->any())
      ->method('language')
      ->willReturn($language);

    $account = $this->createMock(AccountInterface::class);

    $accessControl = new MenuLinkContentAccessControlHandler($entityType$accessManager);
    $accessControl->setModuleHandler($moduleHandler);
    $access = $accessControl->access($entity, 'not-an-op', $account, TRUE);
    $this->assertInstanceOf(AccessResultInterface::class$access);
  }

}
Home | Imprint | This part of the site doesn't use cookies.