You are here

public function PageAccessTest::testAccessView in Page Manager 8.4

Same name and namespace in other branches
  1. 8 tests/src/Unit/PageAccessTest.php \Drupal\Tests\page_manager\Unit\PageAccessTest::testAccessView()

@covers ::checkAccess

File

tests/src/Unit/PageAccessTest.php, line 71

Class

PageAccessTest
Tests access for Page entities.

Namespace

Drupal\Tests\page_manager\Unit

Code

public function testAccessView() {
  $page = $this
    ->prophesize(PageInterface::class);
  $page
    ->getContexts()
    ->willReturn([]);
  $page
    ->getAccessConditions()
    ->willReturn([]);
  $page
    ->getAccessLogic()
    ->willReturn('and');
  $page
    ->status()
    ->willReturn(TRUE);
  $page
    ->language()
    ->willReturn($this
    ->prophesize(LanguageInterface::class)
    ->reveal());
  $page
    ->uuid()
    ->willReturn('some-uuid');
  $page
    ->getEntityTypeId()
    ->shouldBeCalled();
  $account = $this
    ->prophesize(AccountInterface::class);
  $this
    ->assertTrue($this->pageAccess
    ->access($page
    ->reveal(), 'view', $account
    ->reveal()));
}