* Autotest program case.

This commit is contained in:
zhengrunyu
2022-01-18 10:22:42 +08:00
parent 172b4ade25
commit 8ebdc2a3b6
26 changed files with 702 additions and 4 deletions
+41
View File
@@ -0,0 +1,41 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
class Tester
{
public function __construct($user)
{
global $tester;
su('admin');
$this->program = $tester->loadModel('program');
}
public function getPairs()
{
$programs = $this->program->getPairs();
if(!$programs) return 0;
return $programs;
}
public function getCount()
{
return count($this->program->getPairs());
}
}
$t = new Tester('admin');
/**
title=测试 programModel::getPairs();
cid=1
pid=1
*/
r($t->getCount()) && p() && e('10'); // 获取项目集个数
r($t->getPairs()) && p('1') && e('项目集1'); // 获取项目集id/name 的关联数组
r($t->getPairs()) && p('10') && e('项目集10'); // 获取项目集id/name 的关联数组
r($t->getPairs()) && p('11') && e(''); // 获取不存在的项目集id/name 的关联数组