* Adjust unit test for project getPairsByProgram.

This commit is contained in:
caoyanyi
2023-08-16 17:06:02 +08:00
parent e882cb18b3
commit d9f3a281eb
@@ -1,6 +1,7 @@
#!/usr/bin/env php
<?php
include dirname(__FILE__, 5) . '/test/lib/init.php';
zdTable('project')->gen(50);
su('admin');
/**
@@ -9,19 +10,20 @@ title=测试 projectModel->getPairsByProgram();
cid=1
pid=1
查找管理员可查看的所有项目数量 >> 110
查找管理员可查看的所有项目数量 >> 4
查找独立项目数量 >> 0
查找管理员可查看的所属项目集ID为1的项目数量 >> 9
查找管理员可查看的所属项目集ID为1且状态为wait的项目数量 >> 3
查找管理员可查看的所属项目集ID为1且状态不为closed的项目数量 >> 9
查找管理员可查看的所属项目集ID为1的项目数量 >> 4
查找管理员可查看的所属项目集ID为1且状态为wait的项目数量 >> 1
查找管理员可查看的所属项目集ID为1且状态不为closed的项目数量 >> 4
*/
global $tester;
$tester->loadModel('user')->updateProjectView(range(1, 50), array('admin'));
$tester->loadModel('project');
r(count($tester->project->getPairsByProgram('', 'all', true))) && p() && e('110'); // 查找管理员可查看的所有项目数量
r(count($tester->project->getPairsByProgram(0))) && p() && e('0'); // 查找独立项目数量
r(count($tester->project->getPairsByProgram(1))) && p() && e('9'); // 查找管理员可查看的所属项目集ID为1的项目数量
r(count($tester->project->getPairsByProgram(1, 'wait'))) && p() && e('3'); // 查找管理员可查看的所属项目集ID为1且状态为wait的项目数量
r(count($tester->project->getPairsByProgram(1, 'noclosed'))) && p() && e('9'); // 查找管理员可查看的所属项目集ID为1且状态不为closed的项目数量
r(count($tester->project->getPairsByProgram(10, 'all', true))) && p() && e('4'); // 查找管理员可查看的所有项目数量
r(count($tester->project->getPairsByProgram())) && p() && e('0'); // 查找独立项目数量
r(count($tester->project->getPairsByProgram(1))) && p() && e('4'); // 查找管理员可查看的所属项目集ID为1的项目数量
r(count($tester->project->getPairsByProgram(1, 'wait'))) && p() && e('1'); // 查找管理员可查看的所属项目集ID为1且状态为wait的项目数量
r(count($tester->project->getPairsByProgram(1, 'noclosed'))) && p() && e('4'); // 查找管理员可查看的所属项目集ID为1且状态不为closed的项目数量