Skip to content

Instantly share code, notes, and snippets.

@amitaibu
Created August 5, 2016 19:13
Show Gist options
  • Save amitaibu/7342c16b55191fda27bd02063c0da866 to your computer and use it in GitHub Desktop.
Save amitaibu/7342c16b55191fda27bd02063c0da866 to your computer and use it in GitHub Desktop.
// $this->entityManager->getStorage('og_membership')
// ->willReturn($this->entityStorage->reveal());
//
// $this->entityManager->getEntityTypeFromClass('Drupal\og\Entity\OgMembership')
// ->willReturn('og_membership');
//
// // Create a mocked Og Membership entity.
// $membership_entity = $this->prophesize(OgMembershipInterface::class);
//
// $this->entityStorage
// ->create(Argument::type('array'))
// ->willReturn($membership_entity->reveal());
//
// // Create a mocked test group.
// $this->group = $this->prophesize(EntityInterface::class);
//
// // Create a mocked test user.
// $this->user = $this->prophesize(AccountInterface::class);
//
// $membership_entity
// ->setUser($this->user)
// ->willReturn($membership_entity->reveal());
//
// $membership_entity
// ->setGroup($this->group)
// ->willReturn($membership_entity->reveal());
//
// $container = new ContainerBuilder();
// $container->set('entity.manager', $this->entityManager->reveal());
// \Drupal::setContainer($container);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment