Exemplo n.º 1
0
 public function testRelationClassEncode()
 {
     $obj = new Object("TestObject");
     $rel = $obj->getRelation("likes");
     $out = $rel->encode();
     $this->assertEquals("Relation", $out["__type"]);
     $child1 = new Object("User", "abc101");
     $rel->add($child1);
     $out = $rel->encode();
     $this->assertEquals("User", $out["className"]);
 }
Exemplo n.º 2
0
 /**
  * Test relation
  */
 public function testAddRelation()
 {
     $obj = new Object("TestObject");
     $rel = $obj->getRelation("authors");
     $rel->add(new Object("TestAuthor", "abc101"));
     $out = $rel->encode();
     $this->assertEquals("Relation", $out["__type"]);
     $this->assertEquals("TestAuthor", $out["className"]);
     $val = $obj->get("authors");
     $this->assertTrue($val instanceof Relation);
     $out = $val->encode();
     $this->assertEquals("Relation", $out["__type"]);
     $this->assertEquals("TestAuthor", $out["className"]);
 }
Exemplo n.º 3
0
 public function testEncodeRelation()
 {
     $a = new Object("TestObject", "id001");
     $rel = $a->getRelation("likes");
     $out = Client::encode($rel);
     $this->assertEquals("Relation", $out["__type"]);
 }