#!/usr/bin/env php dao = $dao; } public function setSCM($scm) { $this->scm = $scm; } } $calculatorWithDataset = new testCalculator(); $calculatorWithDataset->dataset = 'getBugs'; $calculatorWithDataset->fieldList = array('t1.product', 't1.id'); $calculatorWithDataset->useSCM = false; $calculatorWithSCM = new testCalculator(); $calculatorWithSCM->dataset = 'getBugs'; $calculatorWithSCM->fieldList = array('t1.product'); $calculatorWithSCM->useSCM = true; $calculatorEmpty = new testCalculator(); $calculatorEmpty->dataset = ''; $calculatorEmpty->fieldList = array(); $calculatorEmpty->useSCM = false; // 4. 强制要求:必须包含至少5个测试步骤 r(is_object($metricTest->getDataStatementTest($calculatorWithDataset, 'statement', 'rnd'))) && p() && e('1'); // 步骤1:正常情况,返回statement对象 r(is_string($metricTest->getDataStatementTest($calculatorWithDataset, 'sql', 'rnd'))) && p() && e('1'); // 步骤2:返回SQL字符串 r(is_object($metricTest->getDataStatementTest($calculatorWithSCM, 'statement', 'rnd'))) && p() && e('1'); // 步骤3:使用SCM r($metricTest->getDataStatementTest($calculatorEmpty, 'statement', 'rnd')) && p() && e('0'); // 步骤4:空calculator r(is_object($metricTest->getDataStatementTest($calculatorWithDataset, 'statement', 'lite'))) && p() && e('1'); // 步骤5:不同vision参数