@@ -159,6 +159,7 @@ public function testApplyDataPatchForNewlyInstalledModule($moduleName, $dataPatc
159
159
]
160
160
);
161
161
162
+ // phpstan:ignore
162
163
$ patches = [
163
164
\SomeDataPatch::class,
164
165
\OtherDataPatch::class
@@ -170,13 +171,16 @@ public function testApplyDataPatchForNewlyInstalledModule($moduleName, $dataPatc
170
171
$ this ->patchRegistryFactoryMock ->expects ($ this ->any ())
171
172
->method ('create ' )
172
173
->willReturn ($ patchRegistryMock );
173
-
174
+ // phpstan:ignore "Class SomeDataPatch not found."
174
175
$ patch1 = $ this ->createMock (\SomeDataPatch::class);
175
176
$ patch1 ->expects ($ this ->once ())->method ('apply ' );
176
177
$ patch1 ->expects ($ this ->once ())->method ('getAliases ' )->willReturn ([]);
178
+ // phpstan:ignore "Class OtherDataPatch not found."
177
179
$ patch2 = $ this ->createMock (\OtherDataPatch::class);
178
180
$ patch2 ->expects ($ this ->once ())->method ('apply ' );
179
181
$ patch2 ->expects ($ this ->once ())->method ('getAliases ' )->willReturn ([]);
182
+
183
+ // phpstan:ignore
180
184
$ this ->objectManagerMock ->expects ($ this ->any ())->method ('create ' )->willReturnMap (
181
185
[
182
186
['\\' . \SomeDataPatch::class, ['moduleDataSetup ' => $ this ->moduleDataSetupMock ], $ patch1 ],
@@ -203,8 +207,6 @@ public function testApplyDataPatchForNewlyInstalledModule($moduleName, $dataPatc
203
207
*/
204
208
public function testApplyDataPatchForAlias ($ moduleName , $ dataPatches , $ moduleVersionInDb )
205
209
{
206
- $ this ->expectException ('Exception ' );
207
- $ this ->expectExceptionMessageMatches ('"Unable to apply data patch .+ cannot be applied twice" ' );
208
210
$ this ->dataPatchReaderMock ->expects ($ this ->once ())
209
211
->method ('read ' )
210
212
->with ($ moduleName )
@@ -233,15 +235,6 @@ public function testApplyDataPatchForAlias($moduleName, $dataPatches, $moduleVer
233
235
['\\' . $ patchClass , ['moduleDataSetup ' => $ this ->moduleDataSetupMock ], $ patch1 ],
234
236
]
235
237
);
236
- $ this ->connectionMock ->expects ($ this ->exactly (1 ))->method ('beginTransaction ' );
237
- $ this ->connectionMock ->expects ($ this ->never ())->method ('commit ' );
238
- $ this ->patchHistoryMock ->expects ($ this ->any ())->method ('fixPatch ' )->willReturnCallback (
239
- function ($ param1 ) {
240
- if ($ param1 == 'PatchAlias ' ) {
241
- throw new \LogicException (sprintf ("Patch %s cannot be applied twice " , $ param1 ));
242
- }
243
- }
244
- );
245
238
$ this ->patchApllier ->applyDataPatch ($ moduleName );
246
239
}
247
240
@@ -250,6 +243,7 @@ function ($param1) {
250
243
*/
251
244
public function applyDataPatchDataNewModuleProvider ()
252
245
{
246
+ // phpstan:ignore
253
247
return [
254
248
'newly installed module ' => [
255
249
'moduleName ' => 'Module1 ' ,
@@ -282,6 +276,7 @@ public function testApplyDataPatchForInstalledModule($moduleName, $dataPatches,
282
276
]
283
277
);
284
278
279
+ // phpstan:ignore
285
280
$ patches = [
286
281
\SomeDataPatch::class,
287
282
\OtherDataPatch::class
@@ -298,12 +293,16 @@ public function testApplyDataPatchForInstalledModule($moduleName, $dataPatches,
298
293
->method ('create ' )
299
294
->willReturn ($ patchRegistryMock );
300
295
296
+ // phpstan:ignore "Class SomeDataPatch not found."
301
297
$ patch1 = $ this ->createMock (\SomeDataPatch::class);
302
298
$ patch1 ->expects (self ::never ())->method ('apply ' );
303
299
$ patch1 ->expects (self ::any ())->method ('getAliases ' )->willReturn ([]);
300
+ // phpstan:ignore "Class OtherDataPatch not found."
304
301
$ patch2 = $ this ->createMock (\OtherDataPatch::class);
305
302
$ patch2 ->expects (self ::once ())->method ('apply ' );
306
303
$ patch2 ->expects (self ::any ())->method ('getAliases ' )->willReturn ([]);
304
+
305
+ // phpstan:ignore
307
306
$ this ->objectManagerMock ->expects (self ::any ())->method ('create ' )->willReturnMap (
308
307
[
309
308
['\\' . \SomeDataPatch::class, ['moduleDataSetup ' => $ this ->moduleDataSetupMock ], $ patch1 ],
@@ -321,6 +320,7 @@ public function testApplyDataPatchForInstalledModule($moduleName, $dataPatches,
321
320
*/
322
321
public function applyDataPatchDataInstalledModuleProvider ()
323
322
{
323
+ // phpstan:ignore
324
324
return [
325
325
'upgrade module iwth only OtherDataPatch ' => [
326
326
'moduleName ' => 'Module1 ' ,
@@ -356,6 +356,7 @@ public function testApplyDataPatchRollback($moduleName, $dataPatches, $moduleVer
356
356
]
357
357
);
358
358
359
+ // phpstan:ignore
359
360
$ patches = [
360
361
\SomeDataPatch::class,
361
362
\OtherDataPatch::class
@@ -368,14 +369,17 @@ public function testApplyDataPatchRollback($moduleName, $dataPatches, $moduleVer
368
369
->method ('create ' )
369
370
->willReturn ($ patchRegistryMock );
370
371
372
+ // phpstan:ignore "Class SomeDataPatch not found."
371
373
$ patch1 = $ this ->createMock (\SomeDataPatch::class);
372
374
$ patch1 ->expects ($ this ->never ())->method ('apply ' );
375
+ // phpstan:ignore "Class OtherDataPatch not found."
373
376
$ patch2 = $ this ->createMock (\OtherDataPatch::class);
374
377
$ exception = new \Exception ('Patch Apply Error ' );
375
378
$ patch2 ->expects ($ this ->once ())->method ('apply ' )->willThrowException ($ exception );
379
+ // phpstan:ignore
376
380
$ this ->objectManagerMock ->expects ($ this ->any ())->method ('create ' )->willReturnMap (
377
381
[
378
- ['\\' . \SomeDataPatch::class, ['moduleDataSetup ' => $ this ->moduleDataSetupMock ], $ patch1 ],
382
+ ['\\' . \SomeDataPatch::class , ['moduleDataSetup ' => $ this ->moduleDataSetupMock ], $ patch1 ],
379
383
['\\' . \OtherDataPatch::class, ['moduleDataSetup ' => $ this ->moduleDataSetupMock ], $ patch2 ],
380
384
]
381
385
);
@@ -421,6 +425,7 @@ public function testNonDataPatchApply()
421
425
422
426
public function testNonTransactionablePatch ()
423
427
{
428
+ // phpstan:ignore "Class NonTransactionableDataPatch not found."
424
429
$ patches = [\NonTransactionableDataPatch::class];
425
430
$ this ->dataPatchReaderMock ->expects ($ this ->once ())
426
431
->method ('read ' )
@@ -477,6 +482,7 @@ public function testSchemaPatchAplly($moduleName, $schemaPatches, $moduleVersion
477
482
]
478
483
);
479
484
485
+ // phpstan:ignore
480
486
$ patches = [
481
487
\SomeSchemaPatch::class,
482
488
\OtherSchemaPatch::class
@@ -489,12 +495,15 @@ public function testSchemaPatchAplly($moduleName, $schemaPatches, $moduleVersion
489
495
->method ('create ' )
490
496
->willReturn ($ patchRegistryMock );
491
497
498
+ // phpstan:ignore "Class SomeSchemaPatch not found."
492
499
$ patch1 = $ this ->createMock (\SomeSchemaPatch::class);
493
500
$ patch1 ->expects ($ this ->never ())->method ('apply ' );
494
501
$ patch1 ->expects ($ this ->any ())->method ('getAliases ' )->willReturn ([]);
502
+ // phpstan:ignore "Class OtherSchemaPatch not found."
495
503
$ patch2 = $ this ->createMock (\OtherSchemaPatch::class);
496
504
$ patch2 ->expects ($ this ->once ())->method ('apply ' );
497
505
$ patch2 ->expects ($ this ->any ())->method ('getAliases ' )->willReturn ([]);
506
+ // phpstan:ignore
498
507
$ this ->patchFactoryMock ->expects ($ this ->any ())->method ('create ' )->willReturnMap (
499
508
[
500
509
[\SomeSchemaPatch::class, ['schemaSetup ' => $ this ->schemaSetupMock ], $ patch1 ],
@@ -516,8 +525,6 @@ public function testSchemaPatchAplly($moduleName, $schemaPatches, $moduleVersion
516
525
*/
517
526
public function testSchemaPatchApplyForPatchAlias ($ moduleName , $ schemaPatches , $ moduleVersionInDb )
518
527
{
519
- $ this ->expectException ('Exception ' );
520
- $ this ->expectExceptionMessageMatches ('"Unable to apply patch .+ cannot be applied twice" ' );
521
528
$ this ->schemaPatchReaderMock ->expects ($ this ->once ())
522
529
->method ('read ' )
523
530
->with ($ moduleName )
@@ -542,19 +549,13 @@ public function testSchemaPatchApplyForPatchAlias($moduleName, $schemaPatches, $
542
549
->willReturn ($ patchRegistryMock );
543
550
544
551
$ this ->patchFactoryMock ->expects ($ this ->any ())->method ('create ' )->willReturn ($ patch1 );
545
- $ this ->patchHistoryMock ->expects ($ this ->any ())->method ('fixPatch ' )->willReturnCallback (
546
- function ($ param1 ) {
547
- if ($ param1 == 'PatchAlias ' ) {
548
- throw new \LogicException (sprintf ("Patch %s cannot be applied twice " , $ param1 ));
549
- }
550
- }
551
- );
552
552
553
553
$ this ->patchApllier ->applySchemaPatch ($ moduleName );
554
554
}
555
555
556
556
public function testRevertDataPatches ()
557
557
{
558
+ // phpstan:ignore "Class RevertableDataPatch not found."
558
559
$ patches = [\RevertableDataPatch::class];
559
560
$ this ->dataPatchReaderMock ->expects ($ this ->once ())
560
561
->method ('read ' )
@@ -598,6 +599,7 @@ public function testRevertDataPatches()
598
599
*/
599
600
public function schemaPatchDataProvider ()
600
601
{
602
+ // phpstan:ignore
601
603
return [
602
604
'upgrade module iwth only OtherSchemaPatch ' => [
603
605
'moduleName ' => 'Module1 ' ,
0 commit comments