function MenuLinkContentEntityAccessTest::testUnrecognizedOperation
Same name in other branches
- 9 core/modules/menu_link_content/tests/src/Unit/MenuLinkContentEntityAccessTest.php \Drupal\Tests\menu_link_content\Unit\MenuLinkContentEntityAccessTest::testUnrecognizedOperation()
- 8.9.x core/modules/menu_link_content/tests/src/Unit/MenuLinkContentEntityAccessTest.php \Drupal\Tests\menu_link_content\Unit\MenuLinkContentEntityAccessTest::testUnrecognizedOperation()
- 11.x core/modules/menu_link_content/tests/src/Unit/MenuLinkContentEntityAccessTest.php \Drupal\Tests\menu_link_content\Unit\MenuLinkContentEntityAccessTest::testUnrecognizedOperation()
Tests an operation not implemented by the access control handler.
@covers ::checkAccess
File
-
core/
modules/ menu_link_content/ tests/ src/ Unit/ MenuLinkContentEntityAccessTest.php, line 30
Class
- MenuLinkContentEntityAccessTest
- Tests menu link content entity access.
Namespace
Drupal\Tests\menu_link_content\UnitCode
public function testUnrecognizedOperation() : void {
$entityType = $this->createMock(EntityTypeInterface::class);
$accessManager = $this->createMock(AccessManagerInterface::class);
$moduleHandler = $this->createMock(ModuleHandlerInterface::class);
$moduleHandler->expects($this->any())
->method('invokeAll')
->willReturn([]);
$language = $this->createMock(LanguageInterface::class);
$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);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.