You are here

protected function EntityPermissionProviderTest::setUp in Entity API 8

Overrides UnitTestCase::setUp

File

tests/src/Unit/EntityPermissionProviderTest.php, line 29

Class

EntityPermissionProviderTest
@coversDefaultClass \Drupal\entity\EntityPermissionProvider @group entity

Namespace

Drupal\Tests\entity\Unit

Code

protected function setUp() {
  parent::setUp();
  $entity_type_bundle_info = $this
    ->prophesize(EntityTypeBundleInfoInterface::class);
  $entity_type_bundle_info
    ->getBundleInfo('white_entity')
    ->willReturn([
    'first' => [
      'label' => 'First',
    ],
    'second' => [
      'label' => 'Second',
    ],
  ]);
  $entity_type_bundle_info
    ->getBundleInfo('black_entity')
    ->willReturn([
    'third' => [
      'label' => 'Third',
    ],
  ]);
  $entity_type_bundle_info
    ->getBundleInfo('pink_entity')
    ->willReturn([
    'third' => [
      'label' => 'Third',
    ],
  ]);
  $this->permissionProvider = new EntityPermissionProvider($entity_type_bundle_info
    ->reveal());
  $this->permissionProvider
    ->setStringTranslation($this
    ->getStringTranslationStub());
}