/** * @dataProvider filterCriteria */ public function testFilter($arraySet, $criteria, $expected) { // build up the rowset $rowset = new Rowset(); foreach ($arraySet as $values) { $rowset->push(new Row($this->accountTableMock, $values)); } $filtered = $rowset->filter($criteria); $this->assertEquals($expected, $filtered->count()); }
public function select($where = null, $whereValues = null, $options = array()) { $result = $this->adapter->select($this->tableName, $where, $whereValues, $options); $rowset = new Rowset(); if (!empty($result)) { foreach ($result as $values) { $rowset->push(new Row($this, $values)); } } return $rowset; }
/** * Convert an array into a rowset as we'd expect from select() * * @param $mockTable Table Mock of our table, required for Row * @param $arraySet array Array or array row values * * @return Rowset Rowset of Rows */ protected function convertArrayToRowset($mockTable, $arraySet) { $rowset = new Rowset(); foreach ($arraySet as $rowValues) { $rowset->push(new Row($mockTable, $rowValues)); } return $rowset; }