comparison core/modules/user/tests/src/Unit/UserAuthTest.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
comparison
equal deleted inserted replaced
4:a9cd425dd02b 5:12f9dff5fda9
1 <?php 1 <?php
2 2
3 namespace Drupal\Tests\user\Unit; 3 namespace Drupal\Tests\user\Unit;
4 4
5 use Drupal\Core\Entity\EntityTypeManagerInterface;
5 use Drupal\Tests\UnitTestCase; 6 use Drupal\Tests\UnitTestCase;
6 use Drupal\user\UserAuth; 7 use Drupal\user\UserAuth;
7 8
8 /** 9 /**
9 * @coversDefaultClass \Drupal\user\UserAuth 10 * @coversDefaultClass \Drupal\user\UserAuth
57 * {@inheritdoc} 58 * {@inheritdoc}
58 */ 59 */
59 protected function setUp() { 60 protected function setUp() {
60 $this->userStorage = $this->getMock('Drupal\Core\Entity\EntityStorageInterface'); 61 $this->userStorage = $this->getMock('Drupal\Core\Entity\EntityStorageInterface');
61 62
62 $entity_manager = $this->getMock('Drupal\Core\Entity\EntityManagerInterface'); 63 /** @var \Drupal\Core\Entity\EntityTypeManagerInterface|\PHPUnit_Framework_MockObject_MockObject $entity_type_manager */
63 $entity_manager->expects($this->any()) 64 $entity_type_manager = $this->createMock(EntityTypeManagerInterface::class);
65 $entity_type_manager->expects($this->any())
64 ->method('getStorage') 66 ->method('getStorage')
65 ->with('user') 67 ->with('user')
66 ->will($this->returnValue($this->userStorage)); 68 ->will($this->returnValue($this->userStorage));
67 69
68 $this->passwordService = $this->getMock('Drupal\Core\Password\PasswordInterface'); 70 $this->passwordService = $this->getMock('Drupal\Core\Password\PasswordInterface');
70 $this->testUser = $this->getMockBuilder('Drupal\user\Entity\User') 72 $this->testUser = $this->getMockBuilder('Drupal\user\Entity\User')
71 ->disableOriginalConstructor() 73 ->disableOriginalConstructor()
72 ->setMethods(['id', 'setPassword', 'save', 'getPassword']) 74 ->setMethods(['id', 'setPassword', 'save', 'getPassword'])
73 ->getMock(); 75 ->getMock();
74 76
75 $this->userAuth = new UserAuth($entity_manager, $this->passwordService); 77 $this->userAuth = new UserAuth($entity_type_manager, $this->passwordService);
76 } 78 }
77 79
78 /** 80 /**
79 * Tests failing authentication with missing credential parameters. 81 * Tests failing authentication with missing credential parameters.
80 * 82 *