znt/module/repo/test/model/addlink.php

42 lines
2 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=测试 repoModel::addLink();
timeout=0
cid=18028
- 执行repo模块的addLinkTest方法参数是$singleTaskComment, 'task' @task #<a href='task-view-1.html' >1</a>
- 执行repo模块的addLinkTest方法参数是$multiTaskComment, 'task' @task #<a href='task-view-1.html' >1</a>
- 执行repo模块的addLinkTest方法参数是$storyComment, 'story' @story #<a href='story-view-1.html' >1</a>
- 执行repo模块的addLinkTest方法参数是$bugComment, 'bug' @bug #<a href='bug-view-1.html' >1</a>
- 执行repo模块的addLinkTest方法参数是$mixedComment, 'task' @task #<a href='task-view-1.html' >1</a>
- 执行repo模块的addLinkTest方法参数是$noMatchComment, 'task' @empty
- 执行repo模块的addLinkTest方法参数是$specialFormatComment, 'task' @Task #<a href='task-view-10.html' >10</a>
*/
include dirname(__FILE__, 5) . '/test/lib/init.php';
include dirname(__FILE__, 2) . '/lib/model.class.php';
su('admin');
$repo = new repoModelTest();
// 测试数据准备
$singleTaskComment = 'Finish task #1.';
$multiTaskComment = 'Fix task #1, #2, #3.';
$storyComment = 'Effort story #1 Cost 1h.';
$bugComment = 'Fix bug #1.';
$mixedComment = 'Fix task #1 and story #2 and bug #3.';
$noMatchComment = 'Anything else without ID.';
$specialFormatComment = 'Task #10, #20 and #30 done.';
r($repo->addLinkTest($singleTaskComment, 'task')) && p() && e("task #<a href='task-view-1.html' >1</a>");
r($repo->addLinkTest($multiTaskComment, 'task')) && p() && e("task #<a href='task-view-1.html' >1</a>");
r($repo->addLinkTest($storyComment, 'story')) && p() && e("story #<a href='story-view-1.html' >1</a>");
r($repo->addLinkTest($bugComment, 'bug')) && p() && e("bug #<a href='bug-view-1.html' >1</a>");
r($repo->addLinkTest($mixedComment, 'task')) && p() && e("task #<a href='task-view-1.html' >1</a>");
r($repo->addLinkTest($noMatchComment, 'task')) && p() && e("empty");
r($repo->addLinkTest($specialFormatComment, 'task')) && p() && e("Task #<a href='task-view-10.html' >10</a>");