+ [misc] Add unit tests for tutorialModel::getDesign() method

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
liugang
2025-09-15 15:06:26 +08:00
co-authored by Claude
parent cdf6578f83
commit d008432450
2 changed files with 48 additions and 0 deletions
@@ -721,4 +721,19 @@ class tutorialTest
return $result;
}
/**
* 测试获取新手模式设计。
* Test get design.
*
* @access public
* @return object
*/
public function getDesignTest(): object
{
$result = $this->objectModel->getDesign();
if(dao::isError()) return dao::getError();
return $result;
}
}
+33
View File
@@ -0,0 +1,33 @@
#!/usr/bin/env php
<?php
/**
title=测试 tutorialModel::getDesign();
timeout=0
cid=0
- 步骤1:验证设计ID属性id @1
- 步骤2:验证设计名称属性name @Test Design
- 步骤3:验证项目ID属性project @2
- 步骤4:验证设计类型属性type @HLDS
- 步骤5:验证描述属性desc @Design Description
*/
// 1. 导入依赖(路径固定,不可修改)
include dirname(__FILE__, 5) . '/test/lib/init.php';
include dirname(__FILE__, 2) . '/lib/tutorial.unittest.class.php';
// 2. 用户登录(选择合适角色)
su('admin');
// 3. 创建测试实例(变量名与模块名一致)
$tutorialTest = new tutorialTest();
// 4. 强制要求:必须包含至少5个测试步骤
r($tutorialTest->getDesignTest()) && p('id') && e('1'); // 步骤1:验证设计ID
r($tutorialTest->getDesignTest()) && p('name') && e('Test Design'); // 步骤2:验证设计名称
r($tutorialTest->getDesignTest()) && p('project') && e('2'); // 步骤3:验证项目ID
r($tutorialTest->getDesignTest()) && p('type') && e('HLDS'); // 步骤4:验证设计类型
r($tutorialTest->getDesignTest()) && p('desc') && e('Design Description'); // 步骤5:验证描述