Skip to content

Commit 465b046

Browse files
committed
WIP: PHPLIB-58: CRUD spec functional tests
1 parent ebe9b98 commit 465b046

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
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+

0 commit comments

Comments
 (0)