@@ -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 /**
@@ -306,7 +306,7 @@ public function testInstallWithCodeBaseRollback()
306306 ['Magento_TestSetupDeclarationModule1 ' ]
307307 );
308308 $ beforeRollback = $ this ->describeTable ->describeShard ('default ' );
309- self :: assertEquals ($ this ->getTrimmedData ()['before ' ], $ beforeRollback );
309+ $ this -> assertTableCreationStatements ($ this ->getTrimmedData ()['before ' ], $ beforeRollback );
310310 //Move db_schema.xml file and tried to install
311311 $ this ->moduleManager ->updateRevision (
312312 'Magento_TestSetupDeclarationModule1 ' ,
@@ -317,7 +317,7 @@ public function testInstallWithCodeBaseRollback()
317317
318318 $ this ->cliCommand ->upgrade ();
319319 $ afterRollback = $ this ->describeTable ->describeShard ('default ' );
320- self :: assertEquals ($ this ->getData ()['after ' ], $ afterRollback );
320+ $ this -> assertTableCreationStatements ($ this ->getData ()['after ' ], $ afterRollback );
321321 }
322322
323323 /**
@@ -344,7 +344,9 @@ public function testTableRename()
344344 $ this ->resourceConnection ->getTableName ('some_table ' ),
345345 $ dataToMigrate
346346 );
347- self ::assertEquals ($ this ->getData ()['before ' ], $ before ['some_table ' ]);
347+ $ this ->isUsingAuroraDb () ?
348+ $ this ->assertStringContainsString ($ this ->getData ()['before ' ], $ before ['some_table ' ]) :
349+ $ this ->assertEquals ($ this ->getData ()['before ' ], $ before ['some_table ' ]);
348350 //Move db_schema.xml file and tried to install
349351 $ this ->moduleManager ->updateRevision (
350352 'Magento_TestSetupDeclarationModule1 ' ,
@@ -355,7 +357,9 @@ public function testTableRename()
355357
356358 $ this ->cliCommand ->upgrade ();
357359 $ after = $ this ->describeTable ->describeShard ('default ' );
358- self ::assertEquals ($ this ->getData ()['after ' ], $ after ['some_table_renamed ' ]);
360+ $ this ->isUsingAuroraDb () ?
361+ $ this ->assertStringContainsString ($ this ->getData ()['after ' ], $ after ['some_table_renamed ' ]) :
362+ $ this ->assertEquals ($ this ->getData ()['after ' ], $ after ['some_table_renamed ' ]);
359363 $ select = $ adapter ->select ()
360364 ->from ($ this ->resourceConnection ->getTableName ('some_table_renamed ' ));
361365 self ::assertEquals ([$ dataToMigrate ], $ adapter ->fetchAll ($ select ));
@@ -459,6 +463,26 @@ public function testInstallationWithDisablingTables()
459463 );
460464 self ::assertNull ($ diff ->getAll ());
461465 $ shardData = $ this ->describeTable ->describeShard (Sharding::DEFAULT_CONNECTION );
462- self ::assertEquals ($ this ->getData (), $ shardData );
466+ $ this ->assertTableCreationStatements ($ this ->getData (), $ shardData );
467+ }
468+
469+ /**
470+ * Assert table creation statements
471+ *
472+ * @param array $expectedData
473+ * @param array $actualData
474+ */
475+ private function assertTableCreationStatements (array $ expectedData , array $ actualData ): void
476+ {
477+ if (!$ this ->isUsingAuroraDb ()) {
478+ $ this ->assertEquals ($ expectedData , $ actualData );
479+ } else {
480+ ksort ($ expectedData );
481+ ksort ($ actualData );
482+ $ this ->assertSameSize ($ expectedData , $ actualData );
483+ foreach ($ expectedData as $ key => $ value ) {
484+ $ this ->assertStringContainsString ($ actualData [$ key ], $ value );
485+ }
486+ }
463487 }
464488}
0 commit comments