Example #1
0
 /**
  * @covers DataBase::fetchField
  */
 public function testFetchField()
 {
     $value = $this->db->fetchField("SELECT name FROM test WHERE id = ?", array(1));
     $this->assertEquals('value 1', $value);
     $v1 = $this->db->fetchField("SELECT id, name FROM test ORDER BY id");
     $this->assertEquals(1, $v1);
     for ($i = 2; $i <= 3; $i++) {
         $this->assertEquals($i, $this->db->fetchField());
     }
     $this->assertEmpty($this->db->fetchField());
     $this->assertEmpty($this->db->fetchField("SELECT id, name FROM test WHERE id = -1"), 'Resulado vazio');
 }