This commit is contained in:
wangyidong
2022-05-07 15:00:57 +08:00
6 changed files with 155 additions and 0 deletions
+44
View File
@@ -0,0 +1,44 @@
<?php
class datatableTest
{
public function __construct()
{
global $tester;
$this->objectModel = $tester->loadModel('datatable');
}
public function getFieldListTest($module, $method)
{
$module = zget($this->objectModel->config->datatable->moduleAlias, "$module-$method", $module);
$result = $this->objectModel->getFieldList($module);
return $result;
}
public function getSettingTest($module, $method)
{
$this->objectModel->app->methodName = $method;
$result = $this->objectModel->getSetting($module);
return $result;
}
public function printHeadTest($data)
{
ob_start();
$this->objectModel->printHead($data['cols'], $data['orderBy'], $data['vars'], $data['checkBox']);
$head = ob_get_clean();
$isTh = strpos($head, '<th data-flex') !== false ? true : false;
$order = $data['orderBy'] ? (strpos($head, "class='sort-") !== false ? true : false) : true;
$vars = $data['vars'] ? (strpos($head, $data['vars']) !== false ? true : false) : true;
$check = $data['checkBox'] ? (strpos($head, 'checkbox-primary') !== false ? true : false) : true;
$result = ($isTh and $order and $vars and $check) ? true : false;
return $result;
}
public function setFixedFieldWidthTest($setting)
{
$result = $this->objectModel->setFixedFieldWidth($setting);
return $result;
}
}
+24
View File
@@ -0,0 +1,24 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/datatable.class.php';
su('admin');
/**
title=测试 datatableModel::getFieldList();
cid=1
pid=1
获取产品模块browse方法自定义列 >> ID
获取项目模块browse方法自定义列 >> 项目名称
获取执行模块task方法自定义列 >> 70
获取测试用例模块browse方法自定义列 >> auto
*/
$datatable = new datatableTest();
r($datatable->getFieldListTest('product', 'browse')) && p('id:title') && e('ID'); //获取产品模块browse方法自定义列
r($datatable->getFieldListTest('project', 'browse')) && p('name:title') && e('项目名称'); //获取项目模块browse方法自定义列
r($datatable->getFieldListTest('execution', 'task')) && p('id:width') && e('70'); //获取执行模块task方法自定义列
r($datatable->getFieldListTest('testcase', 'browse')) && p('title:width') && e('auto'); //获取测试用例模块browse方法自定义列
+24
View File
@@ -0,0 +1,24 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/datatable.class.php';
su('admin');
/**
title=测试 datatableModel::getSetting();
cid=1
pid=1
获取产品模块browse方法设置 >> ID
获取项目模块browse方法设置 >> 项目名称
获取执行模块task方法设置 >> 70
获取测试用例模块browse方法设置 >> auto
*/
$datatable = new datatableTest();
r($datatable->getSettingTest('product', 'browse')) && p('0:title') && e('ID'); //获取产品模块browse方法设置
r($datatable->getSettingTest('project', 'browse')) && p('1:title') && e('项目名称'); //获取项目模块browse方法设置
r($datatable->getSettingTest('execution', 'task')) && p('0:width') && e('70'); //获取执行模块task方法设置
r($datatable->getSettingTest('testcase', 'browse')) && p('2:width') && e('auto'); //获取测试用例模块browse方法设置
+31
View File
@@ -0,0 +1,31 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/datatable.class.php';
su('admin');
/**
title=测试 datatableModel::printHead();
cid=1
pid=1
获取产品模块browse方法头部html >> 1
获取产品模块browse方法头部html带排序 >> 1
获取产品模块browse方法头部html带参数 >> 1
获取产品模块browse方法头部html带checkbox >> 1
*/
$datatable = new datatableTest();
$productSetting = $datatable->getSettingTest('product', 'browse');
$data = array('cols' => $productSetting[0], 'orderBy' => '', 'vars' => '', 'checkBox' => false);
$data_order = array('cols' => $productSetting[0], 'orderBy' => 'id_asc', 'vars' => '', 'checkBox' => false);
$data_vars = array('cols' => $productSetting[0], 'orderBy' => 'id_asc', 'vars' => 'productID=1', 'checkBox' => false);
$data_check = array('cols' => $productSetting[0], 'orderBy' => 'id_asc', 'vars' => 'productID=1', 'checkBox' => true);
r($datatable->printHeadTest($data)) && p() && e(1); //获取产品模块browse方法头部html
r($datatable->printHeadTest($data_order)) && p() && e(1); //获取产品模块browse方法头部html带排序
r($datatable->printHeadTest($data_vars)) && p() && e(1); //获取产品模块browse方法头部html带参数
r($datatable->printHeadTest($data_check)) && p() && e(1); //获取产品模块browse方法头部html带checkbox
@@ -0,0 +1,29 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/datatable.class.php';
su('admin');
/**
title=测试 datatableModel::setFixedFieldWidth();
cid=1
pid=1
获取产品模块browse方法设置宽度 >> 550
获取项目模块browse方法设置宽度 >> 180
获取执行模块task方法设置宽度 >> 550
获取测试用例模块browse方法设置宽度 >> 150
*/
$datatable = new datatableTest();
$productSetting = $datatable->getSettingTest('product', 'browse');
$projectSetting = $datatable->getSettingTest('project', 'browse');
$executionSetting = $datatable->getSettingTest('execution', 'task');
$testcaseSetting = $datatable->getSettingTest('testcase', 'browse');
r($datatable->setFixedFieldWidthTest($productSetting)) && p('leftWidth') && e('550'); //获取产品模块browse方法设置宽度
r($datatable->setFixedFieldWidthTest($projectSetting)) && p('rightWidth') && e('180'); //获取项目模块browse方法设置宽度
r($datatable->setFixedFieldWidthTest($executionSetting)) && p('leftWidth') && e('550'); //获取执行模块browse方法设置宽度
r($datatable->setFixedFieldWidthTest($testcaseSetting)) && p('rightWidth') && e('150'); //获取测试用例模块browse方法设置宽度
+3
View File
@@ -43,6 +43,9 @@ switch($argv[1])
case 'cron':
ztfRun('model/cron');
break;
case 'datatable':
ztfRun('model/datatable');
break;
case 'dept':
ztfRun('model/dept');
break;