+ [misc] Add unit tests for tutorialModel::getColumn() method
🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
declare(strict_types = 1);
|
||||
|
||||
require_once dirname(__FILE__, 5) . '/test/lib/test.class.php';
|
||||
|
||||
class tutorialModelTest extends baseTest
|
||||
{
|
||||
protected $moduleName = 'tutorial';
|
||||
protected $className = 'model';
|
||||
|
||||
/**
|
||||
* Test getColumn method.
|
||||
*
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function getColumnTest()
|
||||
{
|
||||
$result = $this->invokeArgs('getColumn', []);
|
||||
if(dao::isError()) return dao::getError();
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
Executable
+30
@@ -0,0 +1,30 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
/**
|
||||
|
||||
title=测试 tutorialModel::getColumn();
|
||||
timeout=0
|
||||
cid=0
|
||||
|
||||
- 步骤1:验证返回值类型 @object
|
||||
- 步骤2:验证id属性属性id @1
|
||||
- 步骤3:验证type属性属性type @backlog
|
||||
- 步骤4:验证name属性属性name @Backlog
|
||||
- 步骤5:验证limit属性属性limit @-1
|
||||
|
||||
*/
|
||||
|
||||
// 1. 导入依赖(路径固定,不可修改)
|
||||
include dirname(__FILE__, 5) . '/test/lib/init.php';
|
||||
include dirname(__FILE__, 2) . '/lib/model.class.php';
|
||||
|
||||
// 2. 创建测试实例(变量名与模块名一致)
|
||||
$tutorialTest = new tutorialModelTest();
|
||||
|
||||
// 3. 执行测试步骤
|
||||
r(gettype($tutorialTest->getColumnTest())) && p() && e('object'); // 步骤1:验证返回值类型
|
||||
r($tutorialTest->getColumnTest()) && p('id') && e('1'); // 步骤2:验证id属性
|
||||
r($tutorialTest->getColumnTest()) && p('type') && e('backlog'); // 步骤3:验证type属性
|
||||
r($tutorialTest->getColumnTest()) && p('name') && e('Backlog'); // 步骤4:验证name属性
|
||||
r($tutorialTest->getColumnTest()) && p('limit') && e('-1'); // 步骤5:验证limit属性
|
||||
Reference in New Issue
Block a user