You are here

class EntityViewDisplayAccessControlHandlerTest in Drupal 10

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Core/Entity/Access/EntityViewDisplayAccessControlHandlerTest.php \Drupal\Tests\Core\Entity\Access\EntityViewDisplayAccessControlHandlerTest
  2. 9 core/tests/Drupal/Tests/Core/Entity/Access/EntityViewDisplayAccessControlHandlerTest.php \Drupal\Tests\Core\Entity\Access\EntityViewDisplayAccessControlHandlerTest

@coversDefaultClass \Drupal\Core\Entity\Entity\Access\EntityViewDisplayAccessControlHandler @group Entity

Hierarchy

Expanded class hierarchy of EntityViewDisplayAccessControlHandlerTest

File

core/tests/Drupal/Tests/Core/Entity/Access/EntityViewDisplayAccessControlHandlerTest.php, line 13

Namespace

Drupal\Tests\Core\Entity\Access
View source
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')
      ->will($this
      ->returnValue(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);
  }

}

Members