1313use PHPUnit \Framework \Attributes \DataProvider ;
1414use PHPUnit \Framework \TestCase ;
1515use Neo4j \QueryAPI \Transaction ;
16+ use Psr \Http \Client \RequestExceptionInterface ;
1617
1718class Neo4jQueryAPIIntegrationTest extends TestCase
1819{
@@ -426,8 +427,13 @@ public function testWithString(): void
426427 $ this ->assertCount (1 , $ results ->getBookmarks ());
427428 }
428429
430+ /**
431+ * @throws Neo4jException
432+ * @throws RequestExceptionInterface
433+ */
429434 public function testWithArray (): void
430435 {
436+ // Expected result
431437 $ expected = new ResultSet (
432438 [
433439 new ResultRow (['n.name ' => 'bob1 ' ]),
@@ -442,16 +448,41 @@ public function testWithArray(): void
442448 new Bookmarks ([])
443449 );
444450
451+ // Actual results from API
445452 $ results = $ this ->api ->run (
446453 'MATCH (n:Person) WHERE n.name IN $names RETURN n.name ' ,
447454 ['names ' => ['bob1 ' , 'alicy ' ]]
448455 );
449456
457+ // Assert counters
450458 $ this ->assertEquals ($ expected ->getQueryCounters (), $ results ->getQueryCounters ());
451- $ this ->assertEquals (iterator_to_array ($ expected ), iterator_to_array ($ results ));
459+
460+ // Compare ResultRows
461+ $ this ->assertCount (count ($ expected ), $ results );
462+
463+ $ expectedRows = iterator_to_array ($ expected );
464+ $ actualRows = iterator_to_array ($ results );
465+
466+ $ this ->assertCount (count ($ expectedRows ), $ actualRows );
467+
468+ // Compare each row
469+ foreach ($ expectedRows as $ expectedRow ) {
470+ $ found = false ;
471+ foreach ($ actualRows as $ actualRow ) {
472+ if ($ expectedRow == $ actualRow ) {
473+ $ found = true ;
474+ break ;
475+ }
476+ }
477+ $ this ->assertTrue ($ found , "Expected row not found: " . json_encode ($ expectedRow ));
478+ }
479+
480+ // Check bookmarks count
452481 $ this ->assertCount (1 , $ results ->getBookmarks ());
453482 }
454483
484+
485+
455486 public function testWithDate (): void
456487 {
457488 $ expected = new ResultSet (
0 commit comments