@@ -182,13 +182,15 @@ public function testCreateProcessShouldReadFromCacheIfCacheIsEnabled(
182
182
* @dataProvider omsProcessCachingWriterDataProvider
183
183
*
184
184
* @param bool $cacheIsEnabled
185
- * @param int $expectedReaderCalls
185
+ * @param bool $regenerateCache
186
+ * @param int|bool $expectedReaderCalls
186
187
* @param int $expectedWriterCalls
187
188
*
188
189
* @return void
189
190
*/
190
191
public function testCreateProcessShouldWriteToCacheIfCacheIsEnabled (
191
192
bool $ cacheIsEnabled ,
193
+ bool $ regenerateCache ,
192
194
int $ expectedReaderCalls ,
193
195
int $ expectedWriterCalls
194
196
): void {
@@ -230,10 +232,10 @@ public function testCreateProcessShouldWriteToCacheIfCacheIsEnabled(
230
232
231
233
// Act
232
234
$ this ->tester ->resetProcessBuffer ();
233
- $ builder ->createProcess ('process-a ' );
235
+ $ builder ->createProcess ('process-a ' , $ regenerateCache );
234
236
235
237
$ this ->tester ->resetProcessBuffer ();
236
- $ builder ->createProcess ('process-a ' );
238
+ $ builder ->createProcess ('process-a ' , $ regenerateCache );
237
239
}
238
240
239
241
/**
@@ -242,13 +244,21 @@ public function testCreateProcessShouldWriteToCacheIfCacheIsEnabled(
242
244
protected function omsProcessCachingWriterDataProvider (): array
243
245
{
244
246
return [
245
- 'test when cache is enabled ' => [
247
+ 'test when cache is enabled and should be regenerated ' => [
248
+ 'cacheIsEnabled ' => true ,
249
+ 'regenerateCache ' => true ,
250
+ 'expectedReaderCalls ' => 2 ,
251
+ 'expectedWriterCalls ' => 2 ,
252
+ ],
253
+ 'test when cache is enabled and should not be regenerated ' => [
246
254
'cacheIsEnabled ' => true ,
255
+ 'regenerateCache ' => false ,
247
256
'expectedReaderCalls ' => 2 ,
248
257
'expectedWriterCalls ' => 1 ,
249
258
],
250
259
'test when cache is disabled ' => [
251
260
'cacheIsEnabled ' => false ,
261
+ 'regenerateCache ' => false ,
252
262
'expectedReaderCalls ' => 0 ,
253
263
'expectedWriterCalls ' => 0 ,
254
264
],
0 commit comments