Exemplo n.º 1
0
 public function testDefaultResultType()
 {
     $data = array('page_template' => 'tpl_test_new8', 'page_type' => 'öäü');
     // will return the auto-increment value of the new row
     $resultInsert = $this->db->insert($this->tableName, $data);
     self::assertGreaterThan(1, $resultInsert);
     $resultSelect = $this->db->select($this->tableName, array('page_id' => $resultInsert));
     // array
     $resultSelect->setDefaultResultType('array');
     $columnResult = $resultSelect->fetch(true);
     self::assertEquals('tpl_test_new8', $columnResult['page_template']);
     $columnResult = $resultSelect->fetchAll();
     self::assertEquals('tpl_test_new8', $columnResult[0]['page_template']);
     $columnResult = $resultSelect->fetchAllArray();
     self::assertEquals('tpl_test_new8', $columnResult[0]['page_template']);
     // object
     $resultSelect->setDefaultResultType('object');
     $columnResult = $resultSelect->fetch(true);
     self::assertEquals('tpl_test_new8', $columnResult->page_template);
     $columnResult = $resultSelect->fetchAll();
     self::assertEquals('tpl_test_new8', $columnResult[0]->page_template);
     $columnResult = $resultSelect->fetchAllObject();
     self::assertEquals('tpl_test_new8', $columnResult[0]->page_template);
 }