@@ -775,6 +775,38 @@ public function testCreateDocumentsWithCreateFromArrayAndRemoveByExample()
775
775
static ::assertSame ($ result , 2 );
776
776
}
777
777
778
+ /**
779
+ * test for creation of documents, and removal by example
780
+ */
781
+ public function testCreateDocumentsWithCreateFromArrayGetAsArrayAndRemoveByExample ()
782
+ {
783
+ $ documentHandler = $ this ->documentHandler ;
784
+ $ collectionHandler = $ this ->collectionHandler ;
785
+
786
+ $ collection = Collection::createFromArray (
787
+ ['name ' => 'ArangoDB_PHP_TestSuite_TestCollection_01 ' , 'waitForSync ' => true ]
788
+ );
789
+ $ collectionHandler ->create ($ collection );
790
+ $ document = Document::createFromArray (
791
+ ['someAttribute ' => 'someValue1 ' , 'someOtherAttribute ' => 'someOtherValue ' ]
792
+ );
793
+ $ documentId = $ documentHandler ->save ($ collection ->getId (), $ document );
794
+ $ documentArray = $ document ->getAll (['_includeInternals ' => false ]);
795
+
796
+ $ exampleDocument = Document::createFromArray (['someOtherAttribute ' => 'someOtherValue ' ]);
797
+ $ cursor = $ collectionHandler ->byExample ($ collection ->getId (), $ exampleDocument , ['_flat ' => true ]);
798
+
799
+ $ array = $ cursor ->getAll ();
800
+
801
+ static ::assertArrayHasKey ('_key ' , $ array [0 ]);
802
+ static ::assertArrayHasKey ('_id ' , $ array [0 ]);
803
+ static ::assertArrayHasKey ('_rev ' , $ array [0 ]);
804
+
805
+ unset($ array [0 ]['_key ' ], $ array [0 ]['_id ' ], $ array [0 ]['_rev ' ]);
806
+
807
+ static ::assertSame ($ array [0 ], $ documentArray );
808
+ }
809
+
778
810
779
811
/**
780
812
* test for creation of documents, and update and replace by example and finally removal by example
0 commit comments