Beispiel #1
0
 public function testMatchesInQuery()
 {
     $q1 = new Query("Post");
     $q1->exists("image");
     $out1 = $q1->encode();
     $where1 = array("image" => array('$exists' => true));
     $this->assertEquals(json_encode($where1), $out1["where"]);
     $query = new Query("TestObject");
     $query->matchesInQuery("post", $q1);
     $out = $query->encode();
     $where = array("post" => array('$inQuery' => array("where" => $where1, "className" => "Post")));
     $this->assertEquals(json_encode($where), $out["where"]);
     $query = new Query("TestObject");
     $query->notMatchInQuery("post", $q1);
     $out = $query->encode();
     $where = array("post" => array('$notInQuery' => array("where" => $where1, "className" => "Post")));
     $this->assertEquals(json_encode($where), $out["where"]);
 }