Skip to content

Commit f239292

Browse files
author
silinmykola
committed
Refactoring Unit tests
1 parent f0a6189 commit f239292

File tree

8 files changed

+4
-54
lines changed

8 files changed

+4
-54
lines changed

app/code/Magento/Sales/Test/Unit/Controller/Adminhtml/Order/Creditmemo/AddCommentTest.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,6 @@ class AddCommentTest extends TestCase
106106
*/
107107
protected function setUp(): void
108108
{
109-
$titleMock = $this->getMockBuilder(\Magento\Framework\App\Action\Title::class)
110-
->disableOriginalConstructor()
111-
->getMock();
112109
$this->requestMock = $this->getMockBuilder(Http::class)
113110
->disableOriginalConstructor()
114111
->getMock();
@@ -117,7 +114,7 @@ protected function setUp(): void
117114
->getMock();
118115
$this->objectManagerMock = $this->getMockForAbstractClass(ObjectManagerInterface::class);
119116
$this->contextMock = $this->getMockBuilder(Context::class)
120-
->setMethods(['getRequest', 'getResponse', 'getObjectManager', 'getTitle'])
117+
->setMethods(['getRequest', 'getResponse', 'getObjectManager'])
121118
->disableOriginalConstructor()
122119
->getMock();
123120
$this->contextMock->expects($this->any())
@@ -129,9 +126,6 @@ protected function setUp(): void
129126
$this->contextMock->expects($this->any())
130127
->method('getObjectManager')
131128
->willReturn($this->objectManagerMock);
132-
$this->contextMock->expects($this->any())
133-
->method('getTitle')
134-
->willReturn($titleMock);
135129
$this->loaderMock = $this->getMockBuilder(CreditmemoLoader::class)
136130
->disableOriginalConstructor()
137131
->getMock();

app/code/Magento/Sales/Test/Unit/Controller/Adminhtml/Order/Creditmemo/CancelTest.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,6 @@ class CancelTest extends TestCase
107107
protected function setUp(): void
108108
{
109109
$this->creditmemoManagementMock = $this->getMockForAbstractClass(CreditmemoManagementInterface::class);
110-
$titleMock = $this->getMockBuilder(\Magento\Framework\App\Action\Title::class)
111-
->disableOriginalConstructor()
112-
->getMock();
113110
$this->requestMock = $this->getMockBuilder(Http::class)
114111
->disableOriginalConstructor()
115112
->getMock();
@@ -148,7 +145,6 @@ protected function setUp(): void
148145
'getRequest',
149146
'getResponse',
150147
'getObjectManager',
151-
'getTitle',
152148
'getSession',
153149
'getHelper',
154150
'getActionFlag',
@@ -179,9 +175,6 @@ protected function setUp(): void
179175
$this->contextMock->expects($this->any())
180176
->method('getObjectManager')
181177
->willReturn($this->objectManagerMock);
182-
$this->contextMock->expects($this->any())
183-
->method('getTitle')
184-
->willReturn($titleMock);
185178
$this->contextMock->expects($this->any())
186179
->method('getMessageManager')
187180
->willReturn($this->messageManagerMock);

app/code/Magento/Sales/Test/Unit/Controller/Adminhtml/Order/Creditmemo/UpdateQtyTest.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,6 @@ protected function setUp(): void
133133
->disableOriginalConstructor()
134134
->setMethods(['getInvoice', 'getOrder', 'cancel', 'getId'])
135135
->getMock();
136-
$titleMock = $this->getMockBuilder(\Magento\Framework\App\Action\Title::class)
137-
->disableOriginalConstructor()
138-
->getMock();
139136
$this->requestMock = $this->getMockBuilder(Http::class)
140137
->disableOriginalConstructor()
141138
->getMock();
@@ -158,7 +155,6 @@ protected function setUp(): void
158155
'getRequest',
159156
'getResponse',
160157
'getObjectManager',
161-
'getTitle',
162158
'getSession',
163159
'getHelper',
164160
'getActionFlag',
@@ -189,9 +185,6 @@ protected function setUp(): void
189185
$this->contextMock->expects($this->any())
190186
->method('getObjectManager')
191187
->willReturn($this->objectManagerMock);
192-
$this->contextMock->expects($this->any())
193-
->method('getTitle')
194-
->willReturn($titleMock);
195188
$this->contextMock->expects($this->any())
196189
->method('getMessageManager')
197190
->willReturn($this->messageManagerMock);

app/code/Magento/Sales/Test/Unit/Controller/Adminhtml/Order/Creditmemo/VoidActionTest.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,6 @@ protected function setUp(): void
127127
->disableOriginalConstructor()
128128
->setMethods(['getInvoice', 'getOrder', 'cancel', 'getId', 'void'])
129129
->getMock();
130-
$titleMock = $this->getMockBuilder(\Magento\Framework\App\Action\Title::class)
131-
->disableOriginalConstructor()
132-
->getMock();
133130
$this->requestMock = $this->getMockBuilder(Http::class)
134131
->disableOriginalConstructor()
135132
->getMock();
@@ -155,7 +152,6 @@ protected function setUp(): void
155152
'getRequest',
156153
'getResponse',
157154
'getObjectManager',
158-
'getTitle',
159155
'getSession',
160156
'getHelper',
161157
'getActionFlag',
@@ -206,9 +202,6 @@ protected function setUp(): void
206202
$this->contextMock->expects($this->any())
207203
->method('getObjectManager')
208204
->willReturn($this->objectManagerMock);
209-
$this->contextMock->expects($this->any())
210-
->method('getTitle')
211-
->willReturn($titleMock);
212205
$this->contextMock->expects($this->any())
213206
->method('getMessageManager')
214207
->willReturn($this->messageManagerMock);

app/code/Magento/Sales/Test/Unit/Controller/Adminhtml/Order/Invoice/AddCommentTest.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,6 @@ protected function setUp(): void
110110
{
111111
$objectManager = new ObjectManager($this);
112112

113-
$titleMock = $this->getMockBuilder(\Magento\Framework\App\Action\Title::class)
114-
->disableOriginalConstructor()
115-
->getMock();
116113
$this->requestMock = $this->getMockBuilder(Http::class)
117114
->disableOriginalConstructor()
118115
->getMock();
@@ -145,17 +142,14 @@ protected function setUp(): void
145142
'getResultRedirectFactory',
146143
'getView'
147144
]
148-
)->addMethods(['getTitle'])
145+
)
149146
->getMock();
150147
$contextMock->expects($this->any())
151148
->method('getRequest')
152149
->willReturn($this->requestMock);
153150
$contextMock->expects($this->any())
154151
->method('getResponse')
155152
->willReturn($this->responseMock);
156-
$contextMock->expects($this->any())
157-
->method('getTitle')
158-
->willReturn($titleMock);
159153
$contextMock->expects($this->any())
160154
->method('getView')
161155
->willReturn($this->viewMock);

app/code/Magento/Sales/Test/Unit/Controller/Adminhtml/Order/Invoice/NewActionTest.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,6 @@ protected function setUp(): void
125125
{
126126
$objectManager = new ObjectManager($this);
127127

128-
$titleMock = $this->getMockBuilder(\Magento\Framework\App\Action\Title::class)
129-
->disableOriginalConstructor()
130-
->getMock();
131128
$this->viewMock = $this->getMockBuilder(View::class)
132129
->disableOriginalConstructor()
133130
->getMock();
@@ -185,17 +182,14 @@ protected function setUp(): void
185182
'getMessageManager',
186183
'getResultRedirectFactory',
187184
'getView'
188-
])->addMethods(['getTitle'])
185+
])
189186
->getMock();
190187
$contextMock->expects($this->any())
191188
->method('getRequest')
192189
->willReturn($this->requestMock);
193190
$contextMock->expects($this->any())
194191
->method('getResponse')
195192
->willReturn($this->responseMock);
196-
$contextMock->expects($this->any())
197-
->method('getTitle')
198-
->willReturn($titleMock);
199193
$contextMock->expects($this->any())
200194
->method('getObjectManager')
201195
->willReturn($this->objectManagerMock);

app/code/Magento/Sales/Test/Unit/Controller/Adminhtml/Order/Invoice/VoidActionTest.php

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,6 @@ class VoidActionTest extends TestCase
4545
*/
4646
protected $responseMock;
4747

48-
/**
49-
* @var MockObject
50-
*/
51-
protected $titleMock;
52-
5348
/**
5449
* @var MockObject
5550
*/
@@ -108,10 +103,6 @@ protected function setUp(): void
108103
{
109104
$objectManager = new ObjectManager($this);
110105

111-
$this->titleMock = $this->getMockBuilder(\Magento\Framework\App\Action\Title::class)
112-
->disableOriginalConstructor()
113-
->getMock();
114-
115106
$this->requestMock = $this->getMockBuilder(Http::class)
116107
->disableOriginalConstructor()
117108
->getMock();
@@ -168,13 +159,12 @@ protected function setUp(): void
168159
'getMessageManager',
169160
'getResultRedirectFactory'
170161
]
171-
)->addMethods(['getTitle'])
162+
)
172163
->getMock();
173164
$contextMock->expects($this->any())->method('getRequest')->willReturn($this->requestMock);
174165
$contextMock->expects($this->any())->method('getResponse')->willReturn($this->responseMock);
175166
$contextMock->expects($this->any())->method('getObjectManager')->willReturn($this->objectManagerMock);
176167
$contextMock->expects($this->any())->method('getMessageManager')->willReturn($this->messageManagerMock);
177-
$contextMock->expects($this->any())->method('getTitle')->willReturn($this->titleMock);
178168
$contextMock->expects($this->any())->method('getActionFlag')->willReturn($this->actionFlagMock);
179169
$contextMock->expects($this->any())->method('getSession')->willReturn($this->sessionMock);
180170
$contextMock->expects($this->any())->method('getHelper')->willReturn($this->helperMock);

lib/internal/Magento/Framework/Mview/Test/Unit/View/SubscriptionTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,6 @@ protected function setUp(): void
124124
]
125125
]
126126
]);
127-
$this->mviewConfig = $mviewConfigMock;
128127
$this->model = new Subscription(
129128
$this->resourceMock,
130129
$this->triggerFactoryMock,

0 commit comments

Comments
 (0)