* Add unit test for common.
This commit is contained in:
Executable
+22
@@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . '/test/lib/init.php';
|
||||
|
||||
zdTable('company')->gen(1);
|
||||
|
||||
/**
|
||||
|
||||
title=测试 commonModel::setCompany();
|
||||
timeout=0
|
||||
cid=1
|
||||
|
||||
- 查看设置的公司名称 @易软天创网络科技有限公司
|
||||
- 查看设置的公司ID @1
|
||||
|
||||
*/
|
||||
|
||||
global $tester, $app;
|
||||
$tester->loadModel('common')->setCompany();
|
||||
|
||||
r($app->company->name) && p('') && e('易软天创网络科技有限公司'); // 查看设置的公司名称
|
||||
r($app->company->id) && p('') && e('1'); // 查看设置的公司ID
|
||||
@@ -4,7 +4,7 @@ include dirname(__FILE__, 5) . '/test/lib/init.php';
|
||||
|
||||
/**
|
||||
|
||||
title=测试 commonModel::diff();
|
||||
title=测试 commonModel::setUserConfig();
|
||||
timeout=0
|
||||
cid=1
|
||||
|
||||
@@ -24,4 +24,4 @@ global $app;
|
||||
r($app->user) && p('account,realname') && e('guest,guest'); // 没有登录的用户,账号和姓名都是guest
|
||||
|
||||
su('admin');
|
||||
r($app->user) && p('account,realname') && e('admin,admin'); // 登录admin账号,账号和姓名都是admin
|
||||
r($app->user) && p('account,realname') && e('admin,admin'); // 登录admin账号,账号和姓名都是admin
|
||||
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . '/test/lib/init.php';
|
||||
su('admin');
|
||||
|
||||
zdTable('project')->config('execution')->gen(400);
|
||||
|
||||
/**
|
||||
|
||||
title=测试 commonModel->syncExecutionByChild();
|
||||
timeout=0
|
||||
cid=1
|
||||
|
||||
- 执行$execution1属性status @wait
|
||||
- 执行$execution2属性status @doing
|
||||
- 执行$execution3属性status @wait
|
||||
- 没有父阶段的数据不会被更新 @0
|
||||
- 没有父阶段的数据不会被更新 @0
|
||||
- 没有父阶段的数据不会被更新 @0
|
||||
|
||||
*/
|
||||
|
||||
global $tester;
|
||||
$tester->loadModel('execution');
|
||||
$tester->loadModel('common');
|
||||
|
||||
$execution1 = $tester->execution->getById(301);
|
||||
$execution2 = $tester->execution->getById(302);
|
||||
$execution3 = $tester->execution->getById(303);
|
||||
|
||||
r($execution1) && p('status') && e('wait');
|
||||
r($execution2) && p('status') && e('doing');
|
||||
r($execution3) && p('status') && e('wait');
|
||||
|
||||
$parentExectuion1 = $tester->common->syncExecutionByChild($execution1);
|
||||
$parentExectuion2 = $tester->common->syncExecutionByChild($execution2);
|
||||
$parentExectuion3 = $tester->common->syncExecutionByChild($execution3);
|
||||
|
||||
r($parentExectuion1) && p('') && e('0'); // 没有父阶段的数据不会被更新
|
||||
r($parentExectuion2) && p('') && e('0'); // 没有父阶段的数据不会被更新
|
||||
r($parentExectuion3) && p('') && e('0'); // 没有父阶段的数据不会被更新
|
||||
Reference in New Issue
Block a user