diff core/modules/rdf/tests/src/Unit/RdfMappingConfigEntityUnitTest.php @ 14:1fec387a4317

Update Drupal core to 8.5.2 via Composer
author Chris Cannam
date Mon, 23 Apr 2018 09:46:53 +0100
parents 4c8ae668cc8c
children
line wrap: on
line diff
--- a/core/modules/rdf/tests/src/Unit/RdfMappingConfigEntityUnitTest.php	Mon Apr 23 09:33:26 2018 +0100
+++ b/core/modules/rdf/tests/src/Unit/RdfMappingConfigEntityUnitTest.php	Mon Apr 23 09:46:53 2018 +0100
@@ -3,6 +3,8 @@
 namespace Drupal\Tests\rdf\Unit;
 
 use Drupal\Core\DependencyInjection\ContainerBuilder;
+use Drupal\Core\Entity\EntityManager;
+use Drupal\Core\Entity\EntityTypeManagerInterface;
 use Drupal\Tests\UnitTestCase;
 use Drupal\rdf\Entity\RdfMapping;
 
@@ -27,6 +29,13 @@
   protected $entityManager;
 
   /**
+   * The entity type manager used for testing.
+   *
+   * @var \Drupal\Core\Entity\EntityTypeManagerInterface|\PHPUnit_Framework_MockObject_MockObject
+   */
+  protected $entityTypeManager;
+
+  /**
    * The ID of the type of the entity under test.
    *
    * @var string
@@ -51,13 +60,16 @@
       ->method('getProvider')
       ->will($this->returnValue('entity'));
 
-    $this->entityManager = $this->getMock('\Drupal\Core\Entity\EntityManagerInterface');
+    $this->entityManager = new EntityManager();
+    $this->entityTypeManager = $this->getMock(EntityTypeManagerInterface::class);
 
     $this->uuid = $this->getMock('\Drupal\Component\Uuid\UuidInterface');
 
     $container = new ContainerBuilder();
     $container->set('entity.manager', $this->entityManager);
+    $container->set('entity_type.manager', $this->entityTypeManager);
     $container->set('uuid', $this->uuid);
+    $this->entityManager->setContainer($container);
     \Drupal::setContainer($container);
 
   }
@@ -77,11 +89,11 @@
       ->method('getBundleEntityType')
       ->will($this->returnValue(NULL));
 
-    $this->entityManager->expects($this->at(0))
+    $this->entityTypeManager->expects($this->at(0))
       ->method('getDefinition')
       ->with($target_entity_type_id)
       ->will($this->returnValue($target_entity_type));
-    $this->entityManager->expects($this->at(1))
+    $this->entityTypeManager->expects($this->at(1))
       ->method('getDefinition')
       ->with($this->entityTypeId)
       ->will($this->returnValue($this->entityType));
@@ -108,11 +120,11 @@
       ->method('getBundleConfigDependency')
       ->will($this->returnValue(['type' => 'config', 'name' => 'test_module.type.' . $bundle_id]));
 
-    $this->entityManager->expects($this->at(0))
+    $this->entityTypeManager->expects($this->at(0))
       ->method('getDefinition')
       ->with($target_entity_type_id)
       ->will($this->returnValue($target_entity_type));
-    $this->entityManager->expects($this->at(1))
+    $this->entityTypeManager->expects($this->at(1))
       ->method('getDefinition')
       ->with($this->entityTypeId)
       ->will($this->returnValue($this->entityType));