'stdClass', 'data' => array(array('foo' => 'bar'), array('foo' => 'baz')), ); $rowset = new Zend_Db_Table_Rowset($config); return $rowset; } public function testRowsetCountInITableRepresentation() { $rowsetTable = new Zend_Test_PHPUnit_Db_DataSet_DbRowset($this->getRowSet(), "fooTable"); $this->assertEquals(2, $rowsetTable->getRowCount()); } public function testRowsetGetSpecificValue() { $rowsetTable = new Zend_Test_PHPUnit_Db_DataSet_DbRowset($this->getRowSet(), "fooTable"); $this->assertEquals("bar", $rowsetTable->getValue(0, "foo")); } public function testRowsetGetSpecificRow() { $rowsetTable = new Zend_Test_PHPUnit_Db_DataSet_DbRowset($this->getRowSet(), "fooTable"); $this->assertEquals(array("foo" => "baz"), $rowsetTable->getRow(1)); } public function testRowset_ConstructWithDisconnectedRowset_NoTableName_ThrowsException() { $this->setExpectedException("Zend_Test_PHPUnit_Db_Exception"); $rowset = $this->getMock('Zend_Db_Table_Rowset_Abstract', array(), array(), '', false); $rowset->expects($this->once()) ->method('getTable') ->will($this->returnValue(null)); $rowsetTable = new Zend_Test_PHPUnit_Db_DataSet_DbRowset($rowset); } public function testRowset_WithNoRows_GetColumnsFromTable() { $columns = array("foo", "bar"); $tableMock = $this->getMock('Zend_Db_Table_Abstract', array(), array(), '', false); $tableMock->expects($this->once()) ->method('info') ->with($this->equalTo('cols')) ->will($this->returnValue($columns)); $rowset = $this->getMock('Zend_Db_Table_Rowset_Abstract', array(), array(), '', false); $rowset->expects($this->exactly(2)) ->method('getTable') ->will($this->returnValue($tableMock)); $rowset->expects($this->once()) ->method('toArray') ->will($this->returnValue( array() )); $rowsetTable = new Zend_Test_PHPUnit_Db_DataSet_DbRowset($rowset, "tableName"); } }