znt/module/requirement/test/model/gettoandcclist.php

79 lines
2.6 KiB
PHP
Executable file
Raw Permalink 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=测试 requirementModel::getToAndCcList();
timeout=0
cid=18192
- 测试步骤1正常story对象和changed动作类型 @admin
- 测试步骤2story对象无assignedTo但有mailto @user1
- 测试步骤3story对象无assignedTo也无mailto @~~
- 测试步骤4story状态为closed检查toList @admin
- 测试步骤5测试reviewed动作类型对story @admin
*/
include dirname(__FILE__, 5) . '/test/lib/init.php';
include dirname(__FILE__, 2) . '/lib/model.class.php';
su('admin');
$requirementTest = new requirementModelTest();
// 测试步骤1正常story对象和changed动作类型
$story1 = new stdClass();
$story1->id = 1;
$story1->assignedTo = 'admin';
$story1->mailto = 'user1,user2';
$story1->type = 'story';
$story1->version = 1;
$story1->status = 'active';
$result1 = $requirementTest->getToAndCcListTest($story1, 'changed');
r($result1) && p('0') && e('admin'); // 测试步骤1正常story对象和changed动作类型
// 测试步骤2story对象无assignedTo但有mailto
$story2 = new stdClass();
$story2->id = 2;
$story2->assignedTo = '';
$story2->mailto = 'user1,user2,user3';
$story2->type = 'story';
$story2->version = 1;
$story2->status = 'active';
$result2 = $requirementTest->getToAndCcListTest($story2, 'opened');
r($result2) && p('0') && e('user1'); // 测试步骤2story对象无assignedTo但有mailto
// 测试步骤3story对象无assignedTo也无mailtoccList中有reviewer时将reviewer作为toList
$story3 = new stdClass();
$story3->id = 3;
$story3->assignedTo = '';
$story3->mailto = '';
$story3->type = 'story';
$story3->version = 1;
$story3->status = 'active';
$result3 = $requirementTest->getToAndCcListTest($story3, 'opened');
r($result3) && p('0') && e('~~'); // 测试步骤3story对象无assignedTo也无mailto
// 测试步骤4story状态为closed
$story4 = new stdClass();
$story4->id = 4;
$story4->assignedTo = 'admin';
$story4->mailto = 'user1';
$story4->type = 'story';
$story4->version = 1;
$story4->status = 'closed';
$story4->openedBy = 'creator';
$result4 = $requirementTest->getToAndCcListTest($story4, 'opened');
r($result4) && p('0') && e('admin'); // 测试步骤4story状态为closed检查toList
// 测试步骤5测试reviewed动作类型对story类型
$story5 = new stdClass();
$story5->id = 5;
$story5->assignedTo = 'admin';
$story5->mailto = 'user1';
$story5->type = 'story';
$story5->version = 1;
$story5->status = 'active';
$result5 = $requirementTest->getToAndCcListTest($story5, 'reviewed');
r($result5) && p('0') && e('admin'); // 测试步骤5测试reviewed动作类型对story