public function testRunsBuiltCommand() { $builder = new ReportCommandBuilder(); $expected = $builder->Build(); $expectedRows = array(array('c' => 'v')); $this->db->SetRows($expectedRows); $rows = $this->repository->GetCustomReport($builder); $this->assertEquals($expected, $this->db->_LastCommand); $this->assertEquals($expectedRows, $rows); }
/** * @param ReportCommandBuilder $commandBuilder * @return array */ public function GetCustomReport(ReportCommandBuilder $commandBuilder) { $query = $commandBuilder->Build(); $reader = ServiceLocator::GetDatabase()->Query($query); $rows = array(); while ($row = $reader->GetRow()) { $rows[] = $row; } $reader->Free(); return $rows; }