@@ -433,10 +433,11 @@ public function testWithString(): void
433433 */
434434 public function testWithArray (): void
435435 {
436+ // Expected result
436437 $ expected = new ResultSet (
437438 [
438- new ResultRow (['n.name ' => 'alicy ' ]),
439- new ResultRow (['n.name ' => 'bob1 ' ])
439+ new ResultRow (['n.name ' => 'bob1 ' ]),
440+ new ResultRow (['n.name ' => 'alicy ' ])
440441 ],
441442 new ResultCounters (
442443 containsUpdates: false ,
@@ -447,16 +448,32 @@ public function testWithArray(): void
447448 new Bookmarks ([])
448449 );
449450
451+ // Actual results from API
450452 $ results = $ this ->api ->run (
451453 'MATCH (n:Person) WHERE n.name IN $names RETURN n.name ' ,
452454 ['names ' => ['bob1 ' , 'alicy ' ]]
453455 );
454456
457+ // Assert counters
455458 $ this ->assertEquals ($ expected ->getQueryCounters (), $ results ->getQueryCounters ());
456- $ this ->assertEquals (iterator_to_array ($ expected ), iterator_to_array ($ results ));
459+
460+ // Assert the number of ResultRows
461+ $ this ->assertCount (count (iterator_to_array ($ expected )), iterator_to_array ($ results ));
462+
463+ // Convert to arrays for comparison
464+ $ expectedRows = iterator_to_array ($ expected );
465+ $ actualRows = iterator_to_array ($ results );
466+
467+ // Ensure all expected rows are present in actual results
468+ foreach ($ expectedRows as $ expectedRow ) {
469+ $ this ->assertContains ($ expectedRow , $ actualRows , "Expected row not found: " . json_encode ($ expectedRow ));
470+ }
471+
472+ // Check bookmarks count
457473 $ this ->assertCount (1 , $ results ->getBookmarks ());
458474 }
459475
476+
460477 public function testWithDate (): void
461478 {
462479 $ expected = new ResultSet (
0 commit comments