public function PanelizerFieldPanelsStorageTest::testAccessChangeContent in Panelizer 8.4
Same name and namespace in other branches
- 8.5 tests/src/Unit/PanelizerFieldPanelsStorageTest.php \Drupal\Tests\panelizer\Unit\PanelizerFieldPanelsStorageTest::testAccessChangeContent()
- 8.3 tests/src/Unit/PanelizerFieldPanelsStorageTest.php \Drupal\Tests\panelizer\Unit\PanelizerFieldPanelsStorageTest::testAccessChangeContent()
@covers ::access
File
- tests/
src/ Unit/ PanelizerFieldPanelsStorageTest.php, line 235
Class
- PanelizerFieldPanelsStorageTest
- Tests the PanelizerFieldPanelsStorage service.
Namespace
Drupal\Tests\panelizer\UnitCode
public function testAccessChangeContent() {
$panels_display = $this
->prophesize(PanelsDisplayVariant::class);
$account = $this
->prophesize(AccountInterface::class);
$entity = $this
->prophesize(FieldableEntityInterface::class);
$entity
->access('update', $account
->reveal(), TRUE)
->willReturn(AccessResult::allowed());
$this->storage
->load('123')
->willReturn($entity
->reveal());
$this->panelizer
->getPanelsDisplay($entity
->reveal(), 'view_mode')
->willReturn($panels_display
->reveal());
$this->panelizer
->hasEntityPermission('change content', $entity
->reveal(), 'view_mode', $account
->reveal())
->willReturn(TRUE);
$access = $this->panelsStorage
->access('entity_type_id:123:view_mode', 'update', $account
->reveal());
$this
->assertEquals(AccessResult::allowed(), $access);
}