+ [misc] Add unit tests for kanbanModel::getCellByCard() 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:17 +08:00
co-authored by Claude
parent 846f06f3a6
commit 44995604c6
3 changed files with 80 additions and 0 deletions
@@ -1770,4 +1770,20 @@ class kanbanTest
return $result;
}
/**
* Test getCellByCard method.
*
* @param int $cardID
* @param int $kanbanID
* @access public
* @return mixed
*/
public function getCellByCardTest($cardID, $kanbanID)
{
$result = $this->objectModel->getCellByCard($cardID, $kanbanID);
if(dao::isError()) return dao::getError();
return $result;
}
}
+37
View File
@@ -0,0 +1,37 @@
#!/usr/bin/env php
<?php
/**
title=测试 kanbanModel::getCellByCard();
timeout=0
cid=0
- 执行kanbanTest模块的getCellByCardTest方法,参数是1, 1
- 属性lane @1
- 属性column @1
- 执行kanbanTest模块的getCellByCardTest方法,参数是3, 1
- 属性lane @1
- 属性column @2
- 执行kanbanTest模块的getCellByCardTest方法,参数是999, 1 @0
- 执行kanbanTest模块的getCellByCardTest方法,参数是1, 999 @0
- 执行kanbanTest模块的getCellByCardTest方法,参数是0, 1 @0
*/
include dirname(__FILE__, 5) . '/test/lib/init.php';
include dirname(__FILE__, 2) . '/lib/kanban.unittest.class.php';
$cell = zenData('kanbancell');
$cell->loadYaml('kanbancell_getcellbycard', false, 2);
$cell->gen(10);
su('admin');
$kanbanTest = new kanbanTest();
r($kanbanTest->getCellByCardTest(1, 1)) && p('lane,column') && e('1,1');
r($kanbanTest->getCellByCardTest(3, 1)) && p('lane,column') && e('1,2');
r($kanbanTest->getCellByCardTest(999, 1)) && p() && e('0');
r($kanbanTest->getCellByCardTest(1, 999)) && p() && e('0');
r($kanbanTest->getCellByCardTest(0, 1)) && p() && e('0');
@@ -0,0 +1,27 @@
---
title: 看板单元格数据定义
desc: 用于测试getCellByCard方法的看板单元格数据
fields:
- field: id
note: 单元格ID
range: 1-10
- field: kanban
note: 看板ID
range: 101{5},102{5}
- field: lane
note: 泳道ID
range: 1{5},2{5}
- field: column
note: 列ID
range: 1-5,1-5
- field: type
note: 单元格类型
range: common
- field: cards
note: 卡片ID列表,逗号分隔格式
fields:
- field: cardid
range: 101,102,103,999,,201,,,,
prefix: ","
postfix: ","