public function testFetchPairsReturnsAccurateResults() { $sql = 'SELECT dewdrop_test_fruit_id, name FROM dewdrop_test_fruits'; $pairs = $this->db->fetchPairs($sql); $this->assertTrue(is_array($pairs)); $this->assertEquals(5, count($pairs)); $int = true; $string = true; foreach ($pairs as $fruitId => $name) { if ($fruitId !== (int) $fruitId) { $int = false; } if (!is_string($name)) { $string = false; } } $this->assertTrue($int && $string); }
/** * Fetch the option pairs using the DB adapter. * * @return array */ public function fetch() { return $this->dbAdapter->fetchPairs($this->getStmt()); }