comparison core/modules/comment/tests/src/Unit/CommentLinkBuilderTest.php @ 5:12f9dff5fda9 tip

Update to Drupal core 8.7.1
author Chris Cannam
date Thu, 09 May 2019 15:34:47 +0100
parents a9cd425dd02b
children
comparison
equal deleted inserted replaced
4:a9cd425dd02b 5:12f9dff5fda9
2 2
3 namespace Drupal\Tests\comment\Unit; 3 namespace Drupal\Tests\comment\Unit;
4 4
5 use Drupal\comment\CommentLinkBuilder; 5 use Drupal\comment\CommentLinkBuilder;
6 use Drupal\comment\Plugin\Field\FieldType\CommentItemInterface; 6 use Drupal\comment\Plugin\Field\FieldType\CommentItemInterface;
7 use Drupal\Core\Entity\EntityTypeManagerInterface;
7 use Drupal\Core\Url; 8 use Drupal\Core\Url;
8 use Drupal\node\NodeInterface; 9 use Drupal\node\NodeInterface;
9 use Drupal\Tests\Traits\Core\GeneratePermutationsTrait; 10 use Drupal\Tests\Traits\Core\GeneratePermutationsTrait;
10 use Drupal\Tests\UnitTestCase; 11 use Drupal\Tests\UnitTestCase;
11 12
30 * @var \Drupal\Core\StringTranslation\TranslationInterface|\PHPUnit_Framework_MockObject_MockObject 31 * @var \Drupal\Core\StringTranslation\TranslationInterface|\PHPUnit_Framework_MockObject_MockObject
31 */ 32 */
32 protected $stringTranslation; 33 protected $stringTranslation;
33 34
34 /** 35 /**
35 * The entity manager service. 36 * The entity type manager.
36 * 37 *
37 * @var \Drupal\Core\Entity\EntityManagerInterface 38 * @var \Drupal\Core\Entity\EntityTypeManagerInterface|\PHPUnit_Framework_MockObject_MockObject
38 */ 39 */
39 protected $entityManager; 40 protected $entityTypeManager;
40 41
41 /** 42 /**
42 * Module handler mock. 43 * Module handler mock.
43 * 44 *
44 * @var \Drupal\Core\Extension\ModuleHandlerInterface|\PHPUnit_Framework_MockObject_MockObject 45 * @var \Drupal\Core\Extension\ModuleHandlerInterface|\PHPUnit_Framework_MockObject_MockObject
68 * Prepares mocks for the test. 69 * Prepares mocks for the test.
69 */ 70 */
70 protected function setUp() { 71 protected function setUp() {
71 $this->commentManager = $this->getMock('\Drupal\comment\CommentManagerInterface'); 72 $this->commentManager = $this->getMock('\Drupal\comment\CommentManagerInterface');
72 $this->stringTranslation = $this->getStringTranslationStub(); 73 $this->stringTranslation = $this->getStringTranslationStub();
73 $this->entityManager = $this->getMock('\Drupal\Core\Entity\EntityManagerInterface'); 74 $this->entityTypeManager = $this->createMock(EntityTypeManagerInterface::class);
74 $this->moduleHandler = $this->getMock('\Drupal\Core\Extension\ModuleHandlerInterface'); 75 $this->moduleHandler = $this->getMock('\Drupal\Core\Extension\ModuleHandlerInterface');
75 $this->currentUser = $this->getMock('\Drupal\Core\Session\AccountProxyInterface'); 76 $this->currentUser = $this->getMock('\Drupal\Core\Session\AccountProxyInterface');
76 $this->commentLinkBuilder = new CommentLinkBuilder($this->currentUser, $this->commentManager, $this->moduleHandler, $this->stringTranslation, $this->entityManager); 77 $this->commentLinkBuilder = new CommentLinkBuilder($this->currentUser, $this->commentManager, $this->moduleHandler, $this->stringTranslation, $this->entityTypeManager);
77 $this->commentManager->expects($this->any()) 78 $this->commentManager->expects($this->any())
78 ->method('getFields') 79 ->method('getFields')
79 ->with('node') 80 ->with('node')
80 ->willReturn([ 81 ->willReturn([
81 'comment' => [], 82 'comment' => [],