/** * @covers ::access */ public function testAccess() { $this->storage->load('id_exists')->willReturn($this->pageVariant->reveal()); $this->storage->load('doesnt_exist')->willReturn(NULL); $account = $this->prophesize(AccountInterface::class); $this->pageVariant->access('read', $account->reveal(), TRUE)->willReturn(AccessResult::allowed()); $panels_storage = new PageManagerPanelsStorage([], '', [], $this->entityTypeManager->reveal()); // Test the access condition. $this->assertEquals(AccessResult::allowed(), $panels_storage->access('id_exists', 'read', $account->reveal())); // Should be forbidden if it doesn't exist. $this->assertEquals(AccessResult::forbidden(), $panels_storage->access('doesnt_exist', 'read', $account->reveal())); }