コード例 #1
0
 /**
  * Tests if the resulting operation array is as expected.
  *
  * @dataProvider providePushTestData
  */
 public function testPush($testData, $expected)
 {
     $push = new Push();
     $push->setPush($testData);
     $result = $push->getOperation();
     $this->assertEquals($expected, $result);
 }
コード例 #2
0
 /**
  * Gets the grouping that groups everything in an array.
  *
  * @param string $field
  */
 private function getGroup($field)
 {
     $group = new Group();
     $group->setGroupBy('_id');
     $condition = Condition::getConditionByIfArray(['$gte' => ['$' . $field, []]], '$' . $field . '_unwrapped', '$' . $field . '_original');
     $push = new Push();
     $push->setPush($condition);
     $group->setResultField($field, $push);
     return $group;
 }