EntityViewDisplayAccessControlHandlerTest.php

Same filename in other branches
  1. 8.9.x core/tests/Drupal/Tests/Core/Entity/Access/EntityViewDisplayAccessControlHandlerTest.php
  2. 10 core/tests/Drupal/Tests/Core/Entity/Access/EntityViewDisplayAccessControlHandlerTest.php
  3. 11.x core/tests/Drupal/Tests/Core/Entity/Access/EntityViewDisplayAccessControlHandlerTest.php

Namespace

Drupal\Tests\Core\Entity\Access

File

core/tests/Drupal/Tests/Core/Entity/Access/EntityViewDisplayAccessControlHandlerTest.php

View source
<?php

namespace Drupal\Tests\Core\Entity\Access;

use Drupal\Core\Entity\Entity\Access\EntityViewDisplayAccessControlHandler;
use Drupal\Core\Entity\Entity\EntityViewDisplay;
use Drupal\Core\Session\AccountInterface;

/**
 * @coversDefaultClass \Drupal\Core\Entity\Entity\Access\EntityViewDisplayAccessControlHandler
 * @group Entity
 */
class EntityViewDisplayAccessControlHandlerTest extends EntityFormDisplayAccessControlHandlerTest {
    
    /**
     * {@inheritdoc}
     */
    protected function setUp() : void {
        parent::setUp();
        $this->member = $this->createMock(AccountInterface::class);
        $this->member
            ->expects($this->any())
            ->method('hasPermission')
            ->willReturnMap([
            [
                'administer foobar display',
                TRUE,
            ],
        ]);
        $this->member
            ->expects($this->any())
            ->method('id')
            ->willReturn(2);
        $this->entity = new EntityViewDisplay([
            'targetEntityType' => 'foobar',
            'bundle' => 'bazqux',
            'mode' => 'default',
            'id' => 'foobar.bazqux.default',
            'uuid' => '6f2f259a-f3c7-42ea-bdd5-111ad1f85ed1',
        ], 'entity_display');
        $this->accessControlHandler = new EntityViewDisplayAccessControlHandler($this->entity
            ->getEntityType());
        $this->accessControlHandler
            ->setModuleHandler($this->moduleHandler);
    }

}

Classes

Title Deprecated Summary
EntityViewDisplayAccessControlHandlerTest @coversDefaultClass \Drupal\Core\Entity\Entity\Access\EntityViewDisplayAccessControlHandler @group Entity

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.