@@ -151,6 +151,7 @@ protected function setUp(): void
151
151
* @param int $configValue
152
152
* @param array|null $collectionItems
153
153
* @param bool|null $emailSendingResult
154
+ * @param int|null $expectedIsEmailSent
154
155
*
155
156
* @return void
156
157
* @dataProvider executeDataProvider
@@ -159,7 +160,8 @@ protected function setUp(): void
159
160
public function testExecute (
160
161
int $ configValue ,
161
162
?array $ collectionItems ,
162
- ?bool $ emailSendingResult
163
+ ?bool $ emailSendingResult ,
164
+ ?int $ expectedIsEmailSent
163
165
): void {
164
166
$ path = 'sales_email/general/async_sending ' ;
165
167
@@ -175,7 +177,12 @@ public function testExecute(
175
177
->method ('addFieldToFilter ' )
176
178
->withConsecutive (
177
179
['send_email ' , ['eq ' => 1 ]],
178
- ['email_sent ' , ['null ' => true ]],
180
+ ['email_sent ' ,
181
+ [
182
+ ['null ' => true ],
183
+ ['lteq ' => -1 ]
184
+ ]
185
+ ],
179
186
['created_at ' , ['from ' => $ fromDate ]]
180
187
);
181
188
@@ -248,7 +255,7 @@ public function testExecute(
248
255
$ collectionItem
249
256
->expects ($ this ->once ())
250
257
->method ('setEmailSent ' )
251
- ->with ($ emailSendingResult )
258
+ ->with ($ expectedIsEmailSent )
252
259
->willReturn ($ collectionItem );
253
260
254
261
$ this ->entityResource
@@ -280,22 +287,26 @@ public function executeDataProvider(): array
280
287
[
281
288
'configValue ' => 1 ,
282
289
'collectionItems ' => [clone $ entityModel ],
283
- 'emailSendingResult ' => true
290
+ 'emailSendingResult ' => true ,
291
+ 'expectedIsEmailSent ' => 1
284
292
],
285
293
[
286
294
'configValue ' => 1 ,
287
295
'collectionItems ' => [clone $ entityModel ],
288
- 'emailSendingResult ' => false
296
+ 'emailSendingResult ' => false ,
297
+ 'expectedIsEmailSent ' => -2
289
298
],
290
299
[
291
300
'configValue ' => 1 ,
292
301
'collectionItems ' => [],
293
- 'emailSendingResult ' => null
302
+ 'emailSendingResult ' => null ,
303
+ 'expectedIsEmailSent ' => 1
294
304
],
295
305
[
296
306
'configValue ' => 0 ,
297
307
'collectionItems ' => null ,
298
- 'emailSendingResult ' => null
308
+ 'emailSendingResult ' => null ,
309
+ 'expectedIsEmailSent ' => 1
299
310
]
300
311
];
301
312
}
0 commit comments