コード例 #1
0
ファイル: RowsetTest.php プロジェクト: m6w6/pq-gateway
 public function testSetRowPrototype()
 {
     $prop = new \ReflectionProperty("\\pq\\Gateway\\Rowset", "row");
     $prop->setAccessible(true);
     $prototype = new Rowset($this->table);
     $this->assertEquals("\\pq\\Gateway\\Row", $prop->getValue($prototype));
     $prototype->setRowPrototype(null);
     $this->assertNull($prop->getValue($prototype));
     $this->table->setRowsetPrototype($prototype);
     $rowset = $this->table->find();
     foreach ($rowset as $row) {
         $this->assertInstanceOf("stdClass", $row);
         $this->assertObjectHasAttribute("id", $row);
     }
     $prototype->setRowPrototype(new Row($this->table));
     $rowset = $this->table->find();
     foreach ($rowset as $index => $row) {
         $this->assertInstanceOf("\\pq\\Gateway\\Row", $row);
         $this->assertEquals($index + 1, $row->id->get());
     }
 }