diff core/modules/comment/tests/src/Unit/CommentManagerTest.php @ 5:12f9dff5fda9 tip

Update to Drupal core 8.7.1
author Chris Cannam
date Thu, 09 May 2019 15:34:47 +0100
parents c75dbcec494b
children
line wrap: on
line diff
--- a/core/modules/comment/tests/src/Unit/CommentManagerTest.php	Thu Feb 28 13:11:55 2019 +0000
+++ b/core/modules/comment/tests/src/Unit/CommentManagerTest.php	Thu May 09 15:34:47 2019 +0100
@@ -3,7 +3,10 @@
 namespace Drupal\Tests\comment\Unit;
 
 use Drupal\comment\CommentManager;
+use Drupal\Core\Entity\EntityFieldManagerInterface;
+use Drupal\Core\Entity\EntityTypeManagerInterface;
 use Drupal\Core\Entity\FieldableEntityInterface;
+use Drupal\Core\Session\AccountInterface;
 use Drupal\Tests\UnitTestCase;
 
 /**
@@ -28,9 +31,10 @@
       ->with(FieldableEntityInterface::class)
       ->will($this->returnValue(TRUE));
 
-    $entity_manager = $this->getMock('Drupal\Core\Entity\EntityManagerInterface');
+    $entity_field_manager = $this->createMock(EntityFieldManagerInterface::class);
+    $entity_type_manager = $this->createMock(EntityTypeManagerInterface::class);
 
-    $entity_manager->expects($this->once())
+    $entity_field_manager->expects($this->once())
       ->method('getFieldMapByFieldType')
       ->will($this->returnValue([
         'node' => [
@@ -40,17 +44,17 @@
         ],
       ]));
 
-    $entity_manager->expects($this->any())
+    $entity_type_manager->expects($this->any())
       ->method('getDefinition')
       ->will($this->returnValue($entity_type));
 
     $comment_manager = new CommentManager(
-      $entity_manager,
+      $entity_type_manager,
       $this->getMock('Drupal\Core\Config\ConfigFactoryInterface'),
       $this->getMock('Drupal\Core\StringTranslation\TranslationInterface'),
-      $this->getMock('Drupal\Core\Routing\UrlGeneratorInterface'),
       $this->getMock('Drupal\Core\Extension\ModuleHandlerInterface'),
-      $this->getMock('Drupal\Core\Session\AccountInterface')
+      $this->createMock(AccountInterface::class),
+      $entity_field_manager
     );
     $comment_fields = $comment_manager->getFields('node');
     $this->assertArrayHasKey('field_foobar', $comment_fields);