You are here

public function PageAccessTest::testAccessViewDisabled in Page Manager 8

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

@covers ::checkAccess

File

tests/src/Unit/PageAccessTest.php, line 96
Contains \Drupal\Tests\page_manager\Unit\PageAccessTest.

Class

PageAccessTest
Tests access for Page entities.

Namespace

Drupal\Tests\page_manager\Unit

Code

public function testAccessViewDisabled() {
  $page = $this
    ->prophesize(PageInterface::class);
  $page
    ->status()
    ->willReturn(FALSE);
  $page
    ->getCacheTags()
    ->willReturn([
    'page:1',
  ]);
  $page
    ->getCacheContexts()
    ->willReturn([]);
  $page
    ->getCacheMaxAge()
    ->willReturn(0);
  $page
    ->language()
    ->willReturn($this
    ->prophesize(LanguageInterface::class)
    ->reveal());
  $page
    ->uuid()
    ->shouldBeCalled();
  $page
    ->getEntityTypeId()
    ->shouldBeCalled();
  $account = $this
    ->prophesize(AccountInterface::class);
  $this
    ->assertFalse($this->pageAccess
    ->access($page
    ->reveal(), 'view', $account
    ->reveal()));
}