|
18 | 18 | use Magento\Framework\App\Response\Http;
|
19 | 19 | use Magento\Framework\Event\ManagerInterface;
|
20 | 20 | use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper;
|
| 21 | +use Magento\Framework\Url; |
21 | 22 | use Magento\Framework\UrlFactory;
|
22 | 23 | use PHPUnit\Framework\MockObject\MockObject;
|
| 24 | +use PHPUnit\Framework\TestCase; |
23 | 25 |
|
24 | 26 | /**
|
25 | 27 | * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
|
26 | 28 | */
|
27 |
| -class SessionTest extends \PHPUnit\Framework\TestCase |
| 29 | +class SessionTest extends TestCase |
28 | 30 | {
|
29 | 31 | /**
|
30 | 32 | * @var ResourceCustomer|MockObject
|
@@ -85,11 +87,11 @@ protected function setUp()
|
85 | 87 | $this->urlFactoryMock = $this->createMock(UrlFactory::class);
|
86 | 88 | $this->customerFactoryMock = $this->getMockBuilder(CustomerFactory::class)
|
87 | 89 | ->disableOriginalConstructor()
|
88 |
| - ->setMethods(['create']) |
| 90 | + ->setMethods(['create', 'save']) |
89 | 91 | ->getMock();
|
90 | 92 | $this->_customerResourceMock = $this->getMockBuilder(ResourceCustomer::class)
|
91 | 93 | ->disableOriginalConstructor()
|
92 |
| - ->setMethods(['load']) |
| 94 | + ->setMethods(['load', 'save']) |
93 | 95 | ->getMock();
|
94 | 96 | $this->customerRepositoryMock = $this->createMock(CustomerRepositoryInterface::class);
|
95 | 97 | $helper = new ObjectManagerHelper($this);
|
@@ -164,7 +166,7 @@ public function testSetCustomerDataAsLoggedIn()
|
164 | 166 | */
|
165 | 167 | public function testAuthenticate()
|
166 | 168 | {
|
167 |
| - $urlMock = $this->createMock(\Magento\Framework\Url::class); |
| 169 | + $urlMock = $this->createMock(Url::class); |
168 | 170 | $urlMock->expects($this->exactly(2))
|
169 | 171 | ->method('getUrl')
|
170 | 172 | ->willReturn('');
|
@@ -216,15 +218,12 @@ protected function prepareLoginDataMock($customerId)
|
216 | 218 |
|
217 | 219 | $customerMock = $this->createPartialMock(
|
218 | 220 | Customer::class,
|
219 |
| - ['getId', 'isConfirmationRequired', 'getConfirmation', 'updateData', 'getGroupId'] |
| 221 | + ['getId', 'getConfirmation', 'updateData', 'getGroupId'] |
220 | 222 | );
|
221 |
| - $customerMock->expects($this->once()) |
| 223 | + $customerMock->expects($this->exactly(3)) |
222 | 224 | ->method('getId')
|
223 | 225 | ->will($this->returnValue($customerId));
|
224 | 226 | $customerMock->expects($this->once())
|
225 |
| - ->method('isConfirmationRequired') |
226 |
| - ->will($this->returnValue(true)); |
227 |
| - $customerMock->expects($this->never()) |
228 | 227 | ->method('getConfirmation')
|
229 | 228 | ->will($this->returnValue($customerId));
|
230 | 229 |
|
@@ -290,6 +289,7 @@ public function testSetCustomerRemovesFlagThatShowsIfCustomerIsEmulated()
|
290 | 289 | $this->_storageMock->expects($this->once())->method('unsIsCustomerEmulated');
|
291 | 290 | $this->_model->setCustomer($customerMock);
|
292 | 291 | }
|
| 292 | + |
293 | 293 | /**
|
294 | 294 | * Test "getCustomer()" for guest user
|
295 | 295 | *
|
|
0 commit comments