Files
EasySoft-ZenTaoPMS/module/action/test/model/printchanges.php
T
2025-09-15 15:06:06 +08:00

29 lines
1.4 KiB
PHP
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env php
<?php
/**
title=测试 actionModel::printChanges();
timeout=0
cid=0
- 步骤1:空历史记录 @0
- 步骤2:单个字段变更 @~任务状态~
- 步骤3:指派给字段变更 @~指派给~
- 步骤4:包含diff信息的变更 @~diff~
- 步骤5canChangeTag为false的测试 @~任务名称~
*/
include dirname(__FILE__, 5) . '/test/lib/init.php';
include dirname(__FILE__, 2) . '/lib/action.unittest.class.php';
su('admin');
$actionTest = new actionTest();
r($actionTest->printChangesTest('task', 1, array())) && p() && e('0'); // 步骤1:空历史记录
r($actionTest->printChangesTest('task', 1, array((object)array('field' => 'status', 'old' => '待处理', 'new' => '进行中', 'diff' => '')))) && p() && e('~任务状态~'); // 步骤2:单个字段变更
r($actionTest->printChangesTest('task', 1, array((object)array('field' => 'assignedTo', 'old' => 'admin', 'new' => 'user1', 'diff' => '')))) && p() && e('~指派给~'); // 步骤3:指派给字段变更
r($actionTest->printChangesTest('task', 1, array((object)array('field' => 'description', 'old' => '旧描述', 'new' => '新描述', 'diff' => '<del>旧描述</del><ins>新描述</ins>')))) && p() && e('~diff~'); // 步骤4:包含diff信息的变更
r($actionTest->printChangesTest('task', 1, array((object)array('field' => 'title', 'old' => '旧标题', 'new' => '新标题', 'diff' => '')), false)) && p() && e('~任务名称~'); // 步骤5canChangeTag为false的测试