X-Git-Url: http://aleph1.co.uk/gitweb/?a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Feditor%2Ftests%2Fsrc%2FUnit%2FEditorConfigEntityUnitTest.php;h=e40e349a74253013aa7d2a0c8ae902af2c020749;hb=0bf8d09d2542548982e81a441b1f16e75873a04f;hp=4e96f4ac65139b46ad61243e56f4184b897f7235;hpb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;p=yaffs-website diff --git a/web/core/modules/editor/tests/src/Unit/EditorConfigEntityUnitTest.php b/web/core/modules/editor/tests/src/Unit/EditorConfigEntityUnitTest.php index 4e96f4ac6..e40e349a7 100644 --- a/web/core/modules/editor/tests/src/Unit/EditorConfigEntityUnitTest.php +++ b/web/core/modules/editor/tests/src/Unit/EditorConfigEntityUnitTest.php @@ -3,6 +3,8 @@ namespace Drupal\Tests\editor\Unit; use Drupal\Core\DependencyInjection\ContainerBuilder; +use Drupal\Core\Entity\EntityManager; +use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\editor\Entity\Editor; use Drupal\Tests\UnitTestCase; @@ -22,9 +24,9 @@ class EditorConfigEntityUnitTest extends UnitTestCase { /** * The entity manager used for testing. * - * @var \Drupal\Core\Entity\EntityManagerInterface|\PHPUnit_Framework_MockObject_MockObject + * @var \Drupal\Core\Entity\EntityTypeManagerInterface|\PHPUnit_Framework_MockObject_MockObject */ - protected $entityManager; + protected $entityTypeManager; /** * The ID of the type of the entity under test. @@ -66,8 +68,8 @@ class EditorConfigEntityUnitTest extends UnitTestCase { ->method('getProvider') ->will($this->returnValue('editor')); - $this->entityManager = $this->getMock('\Drupal\Core\Entity\EntityManagerInterface'); - $this->entityManager->expects($this->any()) + $this->entityTypeManager = $this->getMock(EntityTypeManagerInterface::class); + $this->entityTypeManager->expects($this->any()) ->method('getDefinition') ->with($this->entityTypeId) ->will($this->returnValue($this->entityType)); @@ -78,10 +80,16 @@ class EditorConfigEntityUnitTest extends UnitTestCase { ->disableOriginalConstructor() ->getMock(); + $entity_manager = new EntityManager(); + $container = new ContainerBuilder(); - $container->set('entity.manager', $this->entityManager); + $container->set('entity.manager', $entity_manager); + $container->set('entity_type.manager', $this->entityTypeManager); $container->set('uuid', $this->uuid); $container->set('plugin.manager.editor', $this->editorPluginManager); + // Inject the container into entity.manager so it can defer to + // entity_type.manager. + $entity_manager->setContainer($container); \Drupal::setContainer($container); } @@ -120,7 +128,7 @@ class EditorConfigEntityUnitTest extends UnitTestCase { ->with($format_id) ->will($this->returnValue($filter_format)); - $this->entityManager->expects($this->once()) + $this->entityTypeManager->expects($this->once()) ->method('getStorage') ->with('filter_format') ->will($this->returnValue($storage));