@@ -216,7 +216,7 @@ public function testInstallationWithConstraintsModification()
216
216
);
217
217
self ::assertNull ($ diff ->getAll ());
218
218
$ shardData = $ this ->describeTable ->describeShard (Sharding::DEFAULT_CONNECTION );
219
- self :: assertEquals ($ this ->getTrimmedData (), $ shardData );
219
+ $ this -> assertTableCreationStatements ($ this ->getTrimmedData (), $ shardData );
220
220
}
221
221
222
222
/**
@@ -246,7 +246,7 @@ public function testInstallationWithDroppingTables()
246
246
);
247
247
self ::assertNull ($ diff ->getAll ());
248
248
$ shardData = $ this ->describeTable ->describeShard (Sharding::DEFAULT_CONNECTION );
249
- self :: assertEquals ($ this ->getData (), $ shardData );
249
+ $ this -> assertTableCreationStatements ($ this ->getData (), $ shardData );
250
250
}
251
251
252
252
/**
@@ -305,6 +305,10 @@ public function testInstallWithCodeBaseRollback()
305
305
$ this ->cliCommand ->install (
306
306
['Magento_TestSetupDeclarationModule1 ' ]
307
307
);
308
+
309
+ if ($ this ->isUsingAuroraDb ()) {
310
+ $ this ->markTestSkipped ('Test skipped in AWS Aurora ' );
311
+ }
308
312
$ beforeRollback = $ this ->describeTable ->describeShard ('default ' );
309
313
self ::assertEquals ($ this ->getTrimmedData ()['before ' ], $ beforeRollback );
310
314
//Move db_schema.xml file and tried to install
@@ -344,7 +348,9 @@ public function testTableRename()
344
348
$ this ->resourceConnection ->getTableName ('some_table ' ),
345
349
$ dataToMigrate
346
350
);
347
- self ::assertEquals ($ this ->getData ()['before ' ], $ before ['some_table ' ]);
351
+ $ this ->isUsingAuroraDb () ?
352
+ $ this ->assertStringContainsString ($ before ['some_table ' ], $ this ->getTrimmedData ()['before ' ]) :
353
+ $ this ->assertEquals ($ this ->getData ()['before ' ], $ before ['some_table ' ]);
348
354
//Move db_schema.xml file and tried to install
349
355
$ this ->moduleManager ->updateRevision (
350
356
'Magento_TestSetupDeclarationModule1 ' ,
@@ -355,7 +361,9 @@ public function testTableRename()
355
361
356
362
$ this ->cliCommand ->upgrade ();
357
363
$ after = $ this ->describeTable ->describeShard ('default ' );
358
- self ::assertEquals ($ this ->getData ()['after ' ], $ after ['some_table_renamed ' ]);
364
+ $ this ->isUsingAuroraDb () ?
365
+ $ this ->assertStringContainsString ($ after ['some_table_renamed ' ], $ this ->getTrimmedData ()['after ' ]) :
366
+ $ this ->assertEquals ($ this ->getData ()['after ' ], $ after ['some_table_renamed ' ]);
359
367
$ select = $ adapter ->select ()
360
368
->from ($ this ->resourceConnection ->getTableName ('some_table_renamed ' ));
361
369
self ::assertEquals ([$ dataToMigrate ], $ adapter ->fetchAll ($ select ));
@@ -459,6 +467,26 @@ public function testInstallationWithDisablingTables()
459
467
);
460
468
self ::assertNull ($ diff ->getAll ());
461
469
$ shardData = $ this ->describeTable ->describeShard (Sharding::DEFAULT_CONNECTION );
462
- self ::assertEquals ($ this ->getData (), $ shardData );
470
+ $ this ->assertTableCreationStatements ($ this ->getData (), $ shardData );
471
+ }
472
+
473
+ /**
474
+ * Assert table creation statements
475
+ *
476
+ * @param array $expectedData
477
+ * @param array $actualData
478
+ */
479
+ private function assertTableCreationStatements (array $ expectedData , array $ actualData ): void
480
+ {
481
+ if (!$ this ->isUsingAuroraDb ()) {
482
+ $ this ->assertEquals ($ expectedData , $ actualData );
483
+ } else {
484
+ ksort ($ expectedData );
485
+ ksort ($ actualData );
486
+ $ this ->assertSameSize ($ expectedData , $ actualData );
487
+ foreach ($ expectedData as $ key => $ value ) {
488
+ $ this ->assertStringContainsString ($ actualData [$ key ], $ value );
489
+ }
490
+ }
463
491
}
464
492
}
0 commit comments