_db->select() ->from('zfproducts'); $sql = $select->__toString(); $stmt = new Zend_Db_Statement_Pdo($this->_db, $sql); $this->assertType('Zend_Db_Statement_Pdo', $stmt); $stmt->closeCursor(); } public function testStatementConstructWithSelectObject() { $select = $this->_db->select() ->from('zfproducts'); $stmt = new Zend_Db_Statement_Pdo($this->_db, $select); $this->assertType('Zend_Db_Statement_Interface', $stmt); $stmt->closeCursor(); } public function testStatementNextRowset() { $select = $this->_db->select() ->from('zfproducts'); $stmt = $this->_db->prepare($select->__toString()); try { $stmt->nextRowset(); $this->fail('Expected to catch Zend_Db_Statement_Exception'); } catch (Zend_Exception $e) { $this->assertType('Zend_Db_Statement_Exception', $e, 'Expecting object of type Zend_Db_Statement_Exception, got '.get_class($e)); $this->assertEquals('SQLSTATE[IM001]: Driver does not support this function: driver does not support multiple rowsets', $e->getMessage()); } $stmt->closeCursor(); } /** * @group ZF-4486 */ public function testStatementIsIterableThroughtForeach() { $select = $this->_db->select()->from('zfproducts'); $stmt = $this->_db->query($select); $stmt->setFetchMode(Zend_Db::FETCH_OBJ); foreach ($stmt as $test) { $this->assertTrue($test instanceof stdClass); } $this->assertType('int', iterator_count($stmt)); } }