@@ -216,7 +216,7 @@ public function testInstallationWithConstraintsModification()
216216 );
217217 self ::assertNull ($ diff ->getAll ());
218218 $ shardData = $ this ->describeTable ->describeShard (Sharding::DEFAULT_CONNECTION );
219- self :: assertEquals ($ this ->getTrimmedData (), $ shardData );
219+ $ this -> assertTableCreationStatements ($ this ->getTrimmedData (), $ shardData );
220220 }
221221
222222 /**
@@ -246,7 +246,7 @@ public function testInstallationWithDroppingTables()
246246 );
247247 self ::assertNull ($ diff ->getAll ());
248248 $ shardData = $ this ->describeTable ->describeShard (Sharding::DEFAULT_CONNECTION );
249- self :: assertEquals ($ this ->getData (), $ shardData );
249+ $ this -> assertTableCreationStatements ($ this ->getData (), $ shardData );
250250 }
251251
252252 /**
@@ -305,6 +305,10 @@ public function testInstallWithCodeBaseRollback()
305305 $ this ->cliCommand ->install (
306306 ['Magento_TestSetupDeclarationModule1 ' ]
307307 );
308+
309+ if ($ this ->isUsingAuroraDb ()) {
310+ $ this ->markTestSkipped ('Test skipped in AWS Aurora ' );
311+ }
308312 $ beforeRollback = $ this ->describeTable ->describeShard ('default ' );
309313 self ::assertEquals ($ this ->getTrimmedData ()['before ' ], $ beforeRollback );
310314 //Move db_schema.xml file and tried to install
@@ -344,7 +348,9 @@ public function testTableRename()
344348 $ this ->resourceConnection ->getTableName ('some_table ' ),
345349 $ dataToMigrate
346350 );
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 ' ]);
348354 //Move db_schema.xml file and tried to install
349355 $ this ->moduleManager ->updateRevision (
350356 'Magento_TestSetupDeclarationModule1 ' ,
@@ -355,7 +361,9 @@ public function testTableRename()
355361
356362 $ this ->cliCommand ->upgrade ();
357363 $ 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 ' ]);
359367 $ select = $ adapter ->select ()
360368 ->from ($ this ->resourceConnection ->getTableName ('some_table_renamed ' ));
361369 self ::assertEquals ([$ dataToMigrate ], $ adapter ->fetchAll ($ select ));
@@ -459,6 +467,26 @@ public function testInstallationWithDisablingTables()
459467 );
460468 self ::assertNull ($ diff ->getAll ());
461469 $ 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+ }
463491 }
464492}
0 commit comments