Skip to content

Commit bc5e644

Browse files
committed
Refactor Unit Tests too (remove "expects any()")
1 parent 6b01af9 commit bc5e644

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

app/code/Magento/Quote/Test/Unit/Model/ChangeQuoteControlTest.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,11 @@ protected function setUp(): void
4949
public function testIsAllowedIfTheQuoteIsBelongedToCustomer()
5050
{
5151
$quoteCustomerId = 1;
52-
$this->quoteMock->expects($this->any())->method('getCustomerId')
52+
$this->quoteMock->method('getCustomerId')
5353
->willReturn($quoteCustomerId);
54-
$this->userContextMock->expects($this->any())->method('getUserType')
54+
$this->userContextMock->method('getUserType')
5555
->willReturn(UserContextInterface::USER_TYPE_CUSTOMER);
56-
$this->userContextMock->expects($this->any())->method('getUserId')
56+
$this->userContextMock->method('getUserId')
5757
->willReturn($quoteCustomerId);
5858

5959
$this->assertTrue($this->model->isAllowed($this->quoteMock));
@@ -64,11 +64,11 @@ public function testIsAllowedIfTheQuoteIsNotBelongedToCustomer()
6464
$currentCustomerId = 1;
6565
$quoteCustomerId = 2;
6666

67-
$this->quoteMock->expects($this->any())->method('getCustomerId')
67+
$this->quoteMock->method('getCustomerId')
6868
->willReturn($quoteCustomerId);
69-
$this->userContextMock->expects($this->any())->method('getUserType')
69+
$this->userContextMock->method('getUserType')
7070
->willReturn(UserContextInterface::USER_TYPE_CUSTOMER);
71-
$this->userContextMock->expects($this->any())->method('getUserId')
71+
$this->userContextMock->method('getUserId')
7272
->willReturn($currentCustomerId);
7373

7474
$this->assertFalse($this->model->isAllowed($this->quoteMock));
@@ -77,33 +77,33 @@ public function testIsAllowedIfTheQuoteIsNotBelongedToCustomer()
7777
public function testIsAllowedIfQuoteIsBelongedToGuestAndContextIsGuest()
7878
{
7979
$quoteCustomerId = null;
80-
$this->quoteMock->expects($this->any())->method('getCustomerId')
80+
$this->quoteMock->method('getCustomerId')
8181
->willReturn($quoteCustomerId);
82-
$this->userContextMock->expects($this->any())->method('getUserType')
82+
$this->userContextMock->method('getUserType')
8383
->willReturn(UserContextInterface::USER_TYPE_GUEST);
8484
$this->assertTrue($this->model->isAllowed($this->quoteMock));
8585
}
8686

8787
public function testIsAllowedIfQuoteIsBelongedToCustomerAndContextIsGuest()
8888
{
8989
$quoteCustomerId = 1;
90-
$this->quoteMock->expects($this->any())->method('getCustomerId')
90+
$this->quoteMock->method('getCustomerId')
9191
->willReturn($quoteCustomerId);
92-
$this->userContextMock->expects($this->any())->method('getUserType')
92+
$this->userContextMock->method('getUserType')
9393
->willReturn(UserContextInterface::USER_TYPE_GUEST);
9494
$this->assertFalse($this->model->isAllowed($this->quoteMock));
9595
}
9696

9797
public function testIsAllowedIfContextIsAdmin()
9898
{
99-
$this->userContextMock->expects($this->any())->method('getUserType')
99+
$this->userContextMock->method('getUserType')
100100
->willReturn(UserContextInterface::USER_TYPE_ADMIN);
101101
$this->assertTrue($this->model->isAllowed($this->quoteMock));
102102
}
103103

104104
public function testIsAllowedIfContextIsIntegration()
105105
{
106-
$this->userContextMock->expects($this->any())->method('getUserType')
106+
$this->userContextMock->method('getUserType')
107107
->willReturn(UserContextInterface::USER_TYPE_INTEGRATION);
108108
$this->assertTrue($this->model->isAllowed($this->quoteMock));
109109
}

0 commit comments

Comments
 (0)