diff --git a/module/screen/test/lib/screen.unittest.class.php b/module/screen/test/lib/screen.unittest.class.php index 8fbc2e7140..d7fd1b19f8 100755 --- a/module/screen/test/lib/screen.unittest.class.php +++ b/module/screen/test/lib/screen.unittest.class.php @@ -1228,4 +1228,21 @@ class screenTest return $result; } + /** + * Test buildDataset method. + * + * @param int $chartID + * @param string $driver + * @param string $sql + * @access public + * @return mixed + */ + public function buildDatasetTest($chartID, $driver, $sql = '') + { + $result = $this->objectModel->buildDataset($chartID, $driver, $sql); + if(dao::isError()) return dao::getError(); + + return $result; + } + } diff --git a/module/screen/test/model/builddataset.php b/module/screen/test/model/builddataset.php new file mode 100755 index 0000000000..1a4be62e66 --- /dev/null +++ b/module/screen/test/model/builddataset.php @@ -0,0 +1,29 @@ +#!/usr/bin/env php +buildDatasetTest(20002, 'mysql', '')) && p('0:count') && e('0'); +r($screenTest->buildDatasetTest(20004, 'mysql', '')) && p('0:count') && e('0'); +r($screenTest->buildDatasetTest(20007, 'mysql', '')) && p('0:count') && e('0'); +r($screenTest->buildDatasetTest(10018, 'mysql', 'SELECT COUNT(*) as count FROM zt_user')) && p('0:count') && e('5'); +r($screenTest->buildDatasetTest(999, 'mysql', 'SELECT 1 as test')) && p('0:test') && e('1'); \ No newline at end of file