Beispiel #1
0
 function testRef()
 {
     foreach ($this->table->find() as $row) {
         foreach ($row->allOf("reftest") as $ref) {
             $this->assertEquals($row->id->get(), $ref->ofWhich("test")->current()->id->get());
         }
     }
 }
Beispiel #2
0
 public function testHstore()
 {
     $this->conn->setConverter(new Hstore(new \pq\Types($this->conn)));
     $row = $this->table->find(["id=" => 3])->current();
     $this->assertEquals(null, $row->prop->get());
     $data = array("foo" => "bar", "a" => 1, "b" => 2);
     $row->prop = $data;
     $row->update();
     $this->assertEquals($data, $row->prop->get());
     $row->prop["a"] = null;
     $row->update();
     $data["a"] = null;
     $this->assertEquals($data, $row->prop->get());
     unset($data["a"], $row->prop["a"]);
     $row->update();
     $this->assertEquals($data, $row->prop->get());
 }
Beispiel #3
0
 public function testApplyAppend()
 {
     $rowset1 = $this->table->find(null, null, 1);
     $rowset2 = $this->table->find(null, null, 1, 1);
     $this->assertCount(1, $rowset1);
     $this->assertCount(1, $rowset2);
     $rowset2->apply(array($rowset1, "append"));
     $this->assertCount(1, $rowset2);
     $this->assertCount(2, $rowset1);
 }
Beispiel #4
0
 /**
  * Refresh the rows data
  * @return \pq\Gateway\Row
  */
 function refresh()
 {
     $this->data = $this->table->find($this->criteria(), null, 1, 0)->current()->data;
     $this->cell = array();
     return $this;
 }