File tree Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace MongoDB \Tests \Collection ;
4
+
5
+ use MongoDB \Collection ;
6
+ use MongoDB \Driver \Manager ;
7
+ use MongoDB \Tests \FunctionalTestCase ;
8
+
9
+ /**
10
+ * Functional tests from the CRUD specification.
11
+ *
12
+ * @see https://github.com/mongodb/specifications/tree/master/source/crud/tests
13
+ */
14
+ class CrudSpecFunctionalTest extends FunctionalTestCase
15
+ {
16
+ private $ collection ;
17
+
18
+ public function setUp ()
19
+ {
20
+ parent ::setUp ();
21
+
22
+ $ this ->collection = new Collection ($ this ->manager , $ this ->getNamespace ());
23
+ $ this ->collection ->deleteMany (array ());
24
+ }
25
+
26
+ public function testAggregateWithMultipleStages ()
27
+ {
28
+ $ this ->collection ->insertMany (array (
29
+ array ('_id ' => 1 , 'x ' => 11 ),
30
+ array ('_id ' => 2 , 'x ' => 22 ),
31
+ array ('_id ' => 3 , 'x ' => 33 ),
32
+ ));
33
+
34
+ $ result = $ this ->collection ->aggregate (
35
+ array (
36
+ array ('$sort ' => array ('x ' => 1 )),
37
+ array ('$match ' => array ('_id ' => array ('$gt ' => 1 ))),
38
+ ),
39
+ array ('batchSize ' => 2 )
40
+ );
41
+ }
42
+ }
43
+
You can’t perform that action at this time.
0 commit comments