public function FieldBlockTest::testBlockAccessEntityNotAllowed in Drupal 10
Same name and namespace in other branches
- 8 core/modules/layout_builder/tests/src/Kernel/FieldBlockTest.php \Drupal\Tests\layout_builder\Kernel\FieldBlockTest::testBlockAccessEntityNotAllowed()
- 9 core/modules/layout_builder/tests/src/Kernel/FieldBlockTest.php \Drupal\Tests\layout_builder\Kernel\FieldBlockTest::testBlockAccessEntityNotAllowed()
Tests entity access.
@covers ::blockAccess @dataProvider providerTestBlockAccessNotAllowed
File
- core/
modules/ layout_builder/ tests/ src/ Kernel/ FieldBlockTest.php, line 63
Class
- FieldBlockTest
- @coversDefaultClass \Drupal\layout_builder\Plugin\Block\FieldBlock @group Field
Namespace
Drupal\Tests\layout_builder\KernelCode
public function testBlockAccessEntityNotAllowed($expected, $entity_access) {
$entity = $this
->prophesize(FieldableEntityInterface::class);
$block = $this
->getTestBlock($entity);
$account = $this
->prophesize(AccountInterface::class);
$entity
->access('view', $account
->reveal(), TRUE)
->willReturn($entity_access);
$entity
->hasField()
->shouldNotBeCalled();
$access = $block
->access($account
->reveal(), TRUE);
$this
->assertSame($expected, $access
->isAllowed());
}