* [misc] Enhance unit tests for pivotModel::getProjectExecutions() method
🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Regular → Executable
+20
-10
@@ -1,20 +1,30 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
/**
|
||||
title=测试 pivotModel->geProjectExecution();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
获取项目下的执行,如果是项目下的执行,格式则为「项目名称」/ [执行名称] >> /项目集1,/项目集5/项目集10
|
||||
/**
|
||||
|
||||
title=测试 pivotModel::getProjectExecutions();
|
||||
timeout=0
|
||||
cid=0
|
||||
|
||||
- 测试步骤1:正常情况下获取项目执行列表 @array
|
||||
- 测试步骤2:multiple为1的执行项目格式化 @项目1/迭代1
|
||||
- 测试步骤3:multiple为0的执行项目格式化 @项目2
|
||||
- 测试步骤4:空数据库情况下的处理 @array
|
||||
- 测试步骤5:验证返回数据的键值结构正确 @1
|
||||
|
||||
*/
|
||||
|
||||
include dirname(__FILE__, 5) . '/test/lib/init.php';
|
||||
include dirname(__FILE__, 2) . '/lib/pivot.unittest.class.php';
|
||||
su('admin');
|
||||
|
||||
zenData('project')->gen(0);
|
||||
zenData('project')->loadYaml('project')->gen(10);
|
||||
zenData('project')->loadYaml('execution_project')->gen(10, false, false);
|
||||
su('admin');
|
||||
|
||||
$pivot = new pivotTest();
|
||||
|
||||
r($pivot->getProjectExecutions()) && p('101,110') && e('/项目集1,项目集5/项目集10'); //获取项目下的执行,如果是项目下的执行,格式则为「项目名称」/ [执行名称]
|
||||
// 测试不同场景的getProjectExecutions方法
|
||||
r($pivot->getProjectExecutionsTest('normal_case')) && p() && e('array'); // 测试步骤1:正常情况下获取项目执行列表
|
||||
r($pivot->getProjectExecutionsTest('multiple_format')) && p() && e('项目1/迭代1'); // 测试步骤2:multiple为1的执行项目格式化
|
||||
r($pivot->getProjectExecutionsTest('single_format')) && p() && e('项目2'); // 测试步骤3:multiple为0的执行项目格式化
|
||||
r($pivot->getProjectExecutionsTest('empty_data')) && p() && e('array'); // 测试步骤4:空数据库情况下的处理
|
||||
r($pivot->getProjectExecutionsTest('structure_test')) && p() && e('1'); // 测试步骤5:验证返回数据的键值结构正确
|
||||
Reference in New Issue
Block a user