getTestBlock example

$this->logger = $this->prophesize(LoggerInterface::class);
  }

  /** * Tests entity access. * * @covers ::blockAccess * @dataProvider providerTestBlockAccessNotAllowed */
  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());
  }

  /** * Provides test data for ::testBlockAccessEntityNotAllowed(). */
Home | Imprint | This part of the site doesn't use cookies.