znt/module/design/test/model/getlinkedcommits.php

68 lines
2.3 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=测试 designModel::getLinkedCommits();
timeout=0
cid=15991
- 步骤1正常情况查询设计提交关联数据 @2
- 步骤2查询不存在的仓库ID @0
- 步骤3查询不存在的修订号 @0
- 步骤4查询空的修订号数组 @0
- 步骤5查询多个修订号 @3
*/
include dirname(__FILE__, 5) . '/test/lib/init.php';
include dirname(__FILE__, 2) . '/lib/model.class.php';
zenData('repohistory')->gen(0);
zenData('relation')->gen(0);
zenData('design')->gen(0);
$table = zenData('repohistory');
$table->id->range('1-5');
$table->repo->range('1{5}');
$table->revision->range('abc123,def456,ghi789,jkl012,mno345');
$table->commit->range('1-5');
$table->comment->range('Initial commit,Bug fix,Feature update,Code refactor,Test update');
$table->committer->range('admin,user1,user2,dev1,dev2');
$table->gen(5);
$table = zenData('relation');
$table->id->range('1-5');
$table->project->range('0{5}');
$table->product->range('0{5}');
$table->execution->range('0{5}');
$table->AType->range('design{5}');
$table->AID->range('1,2,3,4,5');
$table->AVersion->range('{5}');
$table->relation->range('completedin{5}');
$table->BType->range('commit{5}');
$table->BID->range('1,2,3,4,5');
$table->BVersion->range('{5}');
$table->extra->range('{5}');
$table->gen(5);
$table = zenData('design');
$table->id->range('1-5');
$table->project->range('11{5}');
$table->product->range('1{5}');
$table->name->range('Design1,Design2,Design3,Design4,Design5');
$table->status->range('active{5}');
$table->createdBy->range('admin{5}');
$table->deleted->range('0{5}');
$table->story->range('0{5}');
$table->gen(5);
su('admin');
$designTest = new designModelTest();
r($designTest->getLinkedCommitsTest(1, array('abc123', 'def456'))) && p() && e('2'); // 步骤1正常情况查询设计提交关联数据
r($designTest->getLinkedCommitsTest(999, array('abc123', 'def456'))) && p() && e('0'); // 步骤2查询不存在的仓库ID
r($designTest->getLinkedCommitsTest(1, array('nonexist'))) && p() && e('0'); // 步骤3查询不存在的修订号
r($designTest->getLinkedCommitsTest(1, array())) && p() && e('0'); // 步骤4查询空的修订号数组
r($designTest->getLinkedCommitsTest(1, array('abc123', 'def456', 'ghi789'))) && p() && e('3'); // 步骤5查询多个修订号