public function testComposeCompexLogicalQuery() { $q1 = new Query("TestObject"); $q1->greaterThanOrEqualTo("number", 42); $q2 = new Query("TestObject"); $q2->lessThan("number", 24); $q3 = new Query("TestObject"); $q3->contains("title", "clojure"); $q = Query::orQuery($q1, $q2); $out = $q->encode(); $where = array('$or' => array(array("number" => array('$gte' => 42)), array("number" => array('$lt' => 24)))); $this->assertEquals(json_encode($where), $out["where"]); $q = Query::andQuery($q, $q3); $out = $q->encode(); $where = array('$and' => array(array('$or' => array(array("number" => array('$gte' => 42)), array("number" => array('$lt' => 24)))), array("title" => array('$regex' => "clojure")))); $this->assertEquals(json_encode($where), $out["where"]); }