znt/module/action/test/model/saveindex.php

47 lines
2.7 KiB
PHP
Executable file

#!/usr/bin/env php
<?php
include dirname(__FILE__, 5) . '/test/lib/init.php';
include dirname(__FILE__, 2) . '/lib/model.class.php';
su('admin');
zenData('action')->gen(5);
zenData('actionrecent')->gen(0);
zenData('bug')->gen(1);
zenData('effort')->gen(1);
zenData('case')->gen(1);
zenData('casestep')->gen(1);
/**
title=测试 actionModel->saveIndex();
timeout=0
cid=14931
- 测试保存空数据 @0
- 测试保存$objectId为0, action为空的数据 @0
- 测试保存$objectId为1, action为空的数据 @0
- 测试保存$objectId为100000, action为空的数据 @0
- 测试保存$objectId为1, action为created的数据 @1
- 测试保存$objectId为100000, action为created的数据 @0
- 测试保存$objectId为1, action为created的数据 @0
- 测试保存$objectId为1, action为efforta,评论不为空的数据 @1
- 测试保存$objectId为1, action为efforta,评论不为空的数据 @0
*/
$objectTypeList = array('', 'bug', 'task', 'effort', 'case');
$objectIdList = array(0, 1, 100000);
$actionTypeList = array('', 'created', 'tested');
$commentList = array('评论1');
$action = new actionModelTest();
r($action->saveIndexTest($objectTypeList[0], $objectIdList[0], $actionTypeList[0])) && p() && e('0'); // 测试保存空数据
r($action->saveIndexTest($objectTypeList[1], $objectIdList[0], $actionTypeList[0])) && p() && e('0'); // 测试保存$objectId为0, action为空的数据
r($action->saveIndexTest($objectTypeList[1], $objectIdList[1], $actionTypeList[0])) && p() && e('0'); // 测试保存$objectId为1, action为空的数据
r($action->saveIndexTest($objectTypeList[1], $objectIdList[2], $actionTypeList[0])) && p() && e('0'); // 测试保存$objectId为100000, action为空的数据
r($action->saveIndexTest($objectTypeList[1], $objectIdList[1], $actionTypeList[1])) && p() && e('1'); // 测试保存$objectId为1, action为created的数据
r($action->saveIndexTest($objectTypeList[1], $objectIdList[2], $actionTypeList[1])) && p() && e('0'); // 测试保存$objectId为100000, action为created的数据
r($action->saveIndexTest($objectTypeList[3], $objectIdList[1], $actionTypeList[1])) && p() && e('0'); // 测试保存$objectId为1, action为created的数据
r($action->saveIndexTest($objectTypeList[4], $objectIdList[1], $actionTypeList[2], $commentList[0])) && p() && e('1'); // 测试保存$objectId为1, action为efforta,评论不为空的数据
r($action->saveIndexTest($objectTypeList[3], $objectIdList[1], $actionTypeList[2], $commentList[0])) && p() && e('0'); // 测试保存$objectId为1, action为efforta,评论不为空的数据