+ Add custom::hasScrumAuditplanData unit test.
This commit is contained in:
@@ -513,4 +513,24 @@ class customTest
|
||||
if(dao::isError()) return dao::getError();
|
||||
return $count;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查系统中是否有审计数据。
|
||||
* Check if there is auditplan data in the system.
|
||||
*
|
||||
* @param string $edition
|
||||
* @access public
|
||||
* @return int|array
|
||||
*/
|
||||
public function hasScrumAuditplanDataTest(string $edition): int|array
|
||||
{
|
||||
$oldEdition = $this->objectModel->config->edition;
|
||||
|
||||
$this->objectModel->config->edition = $edition;
|
||||
$count = $this->objectModel->hasScrumAuditplanData();
|
||||
|
||||
$this->objectModel->config->edition = $oldEdition;
|
||||
if(dao::isError()) return dao::getError();
|
||||
return $count;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
/**
|
||||
|
||||
title=测试 customModel->hasScrumAuditplanData();
|
||||
timeout=0
|
||||
cid=1
|
||||
|
||||
*/
|
||||
|
||||
include dirname(__FILE__, 5) . '/test/lib/init.php';
|
||||
include dirname(__FILE__, 2) . '/custom.class.php';
|
||||
|
||||
$projectTable = zdTable('project');
|
||||
$projectTable->id->range('1-5');
|
||||
$projectTable->model->range('scrum');
|
||||
$projectTable->gen(5);
|
||||
|
||||
zdTable('auditplan')->gen(0);
|
||||
zdTable('user')->gen(5);
|
||||
su('admin');
|
||||
|
||||
$editionList = array('open', 'ipd', 'max');
|
||||
|
||||
$customTester = new customTest();
|
||||
r($customTester->hasScrumAuditplanDataTest($editionList[0])) && p() && e('0'); // 测试开源版中无审计数据
|
||||
r($customTester->hasScrumAuditplanDataTest($editionList[1])) && p() && e('0'); // 测试ipd版中无审计数据
|
||||
r($customTester->hasScrumAuditplanDataTest($editionList[2])) && p() && e('0'); // 测试旗舰版中无审计数据
|
||||
|
||||
$auditplanTable = zdTable('auditplan');
|
||||
$auditplanTable->deleted->range('0');
|
||||
$auditplanTable->project->range('1-5');
|
||||
$auditplanTable->gen(5);
|
||||
r($customTester->hasScrumAuditplanDataTest($editionList[0])) && p() && e('0'); // 测试开源版中有审计数据
|
||||
r($customTester->hasScrumAuditplanDataTest($editionList[1])) && p() && e('5'); // 测试ipd版中有审计数据
|
||||
r($customTester->hasScrumAuditplanDataTest($editionList[2])) && p() && e('5'); // 测试旗舰版中有审计数据
|
||||
Reference in New Issue
Block a user