Permalink
Browse files

Add tests for box and center bounds queries

  • Loading branch information...
1 parent 60a99e5 commit b5c5d0499f4db2531de6eea54d38b75e485ceef4 @jmikola jmikola committed Jun 20, 2012
Showing with 30 additions and 0 deletions.
  1. +30 −0 tests/Doctrine/MongoDB/Tests/Query/BuilderTest.php
@@ -366,6 +366,36 @@ public function testDeepClone()
$this->assertCount(1, $qb->getQueryArray());
}
+ public function testWithinBox()
+ {
+ $qb = $this->getTestQueryBuilder()
+ ->field('loc')->withinBox(0, 0, 2, 2);
+
+ $expected = array(
+ 'loc' => array(
+ '$within' => array(
+ '$box' => array(array(0, 0), array(2, 2)),
+ ),
+ ),
+ );
+ $this->assertEquals($expected, $qb->getQueryArray());
+ }
+
+ public function testWithinCenter()
+ {
+ $qb = $this->getTestQueryBuilder()
+ ->field('loc')->withinCenter(0, 0, 1);
+
+ $expected = array(
+ 'loc' => array(
+ '$within' => array(
+ '$center' => array(array(0, 0), 1),
+ ),
+ ),
+ );
+ $this->assertEquals($expected, $qb->getQueryArray());
+ }
+
public function testWithinPolygon()
{
$qb = $this->getTestQueryBuilder()

0 comments on commit b5c5d04

Please sign in to comment.