+ Add unit test for screenModel::getList.

This commit is contained in:
wangxuepeng
2023-11-29 14:30:57 +08:00
parent c4a957b7d5
commit e6b482ba1f
5 changed files with 158 additions and 0 deletions
+26
View File
@@ -0,0 +1,26 @@
#!/usr/bin/env php
<?php
include dirname(__FILE__, 5) . '/test/lib/init.php';
include dirname(__FILE__, 2) . '/screen.class.php';
zdTable('screen')->gen(0);
zdTable('screen')->config('screen-1')->gen(1, false, false);
zdTable('screen')->config('screen-2')->gen(1, false, false);
/**
title=测试 screenModel->getList();
cid=1
pid=1
测试获取dimension=0的数据 >> 0
测试获取dimension=1的数据 >> 2
测试获取dimension=10000的数据 >> 0
*/
$screen = new screenTest();
$dimension = array(0, 1, 10000);
r(count($screen->getListTest($dimension[0]))) && p('') && e(0); //测试获取dimension=0的数据
r(count($screen->getListTest($dimension[1]))) && p('') && e(2); //测试获取dimension=1的数据
r(count($screen->getListTest($dimension[2]))) && p('') && e(0); //测试获取dimension=10000的数据
+21
View File
@@ -0,0 +1,21 @@
<?php
class screenTest
{
public function __construct()
{
global $tester;
$this->objectModel = $tester->loadModel('screen');
}
/**
* 测试getList。
* Test getList.
*
* @param int $dimensionID 维度ID。
* @return array
*/
public function getListTest(int $dimensionID): array
{
return $this->objectModel->getList($dimensionID);
}
}
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long