You are here

protected function GroupContentEnablerManagerTest::setUp in Group 8

Overrides UnitTestCase::setUp

File

tests/src/Unit/GroupContentEnablerManagerTest.php, line 72

Class

GroupContentEnablerManagerTest
Tests the GroupContentEnabler plugin manager.

Namespace

Drupal\Tests\group\Unit

Code

protected function setUp() {
  parent::setUp();
  $this->cacheBackend = $this
    ->prophesize(CacheBackendInterface::class);
  $this->moduleHandler = $this
    ->prophesize(ModuleHandlerInterface::class);
  $this->moduleHandler
    ->getImplementations('entity_type_build')
    ->willReturn([]);
  $this->moduleHandler
    ->alter('group_content_info', Argument::type('array'))
    ->willReturn(NULL);
  $this->entityTypeManager = $this
    ->prophesize(EntityTypeManagerInterface::class);
  $storage = $this
    ->prophesize(ContentEntityStorageInterface::class);
  $this->entityTypeManager
    ->getStorage('group')
    ->willReturn($storage
    ->reveal());
  $storage = $this
    ->prophesize(ConfigEntityStorageInterface::class);
  $this->entityTypeManager
    ->getStorage('group_type')
    ->willReturn($storage
    ->reveal());
  $this->groupContentEnablerManager = new TestGroupContentEnablerManager(new \ArrayObject(), $this->cacheBackend
    ->reveal(), $this->moduleHandler
    ->reveal(), $this->entityTypeManager
    ->reveal());
  $this->discovery = $this
    ->prophesize(DiscoveryInterface::class);
  $this->groupContentEnablerManager
    ->setDiscovery($this->discovery
    ->reveal());
  $this->container = $this
    ->prophesize(ContainerInterface::class);
  $this->groupContentEnablerManager
    ->setContainer($this->container
    ->reveal());
}