use Drupal\Core\Entity\Entity;
use Drupal\Core\Entity\EntityMalformedException;
-use Drupal\Core\Entity\EntityManagerInterface;
+use Drupal\Core\Entity\EntityTypeBundleInfoInterface;
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Entity\Exception\UndefinedLinkTemplateException;
use Drupal\Core\Entity\RevisionableInterface;
class EntityUrlTest extends UnitTestCase {
/**
- * The entity manager mock used in this test.
+ * The entity type bundle info service mock used in this test.
*
- * @var \Prophecy\Prophecy\ProphecyInterface|\Drupal\Core\Entity\EntityManagerInterface
+ * @var \Prophecy\Prophecy\ProphecyInterface|\Drupal\Core\Entity\EntityTypeBundleInfoInterface
*/
- protected $entityManager;
+ protected $entityTypeBundleInfo;
/**
* The ID of the entity type used in this test.
* @return \Drupal\Core\Entity\Entity|\PHPUnit_Framework_MockObject_MockObject
*/
protected function getEntity($class, array $values, array $methods = []) {
- $methods = array_merge($methods, ['getEntityType', 'entityManager']);
+ $methods = array_merge($methods, ['getEntityType', 'entityManager', 'entityTypeBundleInfo']);
// Prophecy does not allow prophesizing abstract classes while actually
// calling their code. We use Prophecy below because that allows us to
$this->entityType->getKey('langcode')->willReturn(FALSE);
$entity->method('getEntityType')->willReturn($this->entityType->reveal());
- $this->entityManager = $this->prophesize(EntityManagerInterface::class);
- $entity->method('entityManager')->willReturn($this->entityManager->reveal());
+ $this->entityTypeBundleInfo = $this->prophesize(EntityTypeBundleInfoInterface::class);
+ $entity->method('entityTypeBundleInfo')->willReturn($this->entityTypeBundleInfo->reveal());
return $entity;
}
* The bundle information to register.
*/
protected function registerBundleInfo($bundle_info) {
- $this->entityManager
+ $this->entityTypeBundleInfo
->getBundleInfo($this->entityTypeId)
->willReturn([$this->entityTypeId => $bundle_info]);
}