+ Add custom::hasProductURData unit test.
This commit is contained in:
@@ -389,4 +389,19 @@ class customTest
|
||||
|
||||
return $this->objectModel->dao->select('status')->from(TABLE_CRON)->where('command')->like('%methodName=execCrontabQueue')->fetch('status');
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查系统中是否有用户需求数据。
|
||||
* Check if there is requirement data in the system.
|
||||
*
|
||||
* @access public
|
||||
* @return int|array
|
||||
*/
|
||||
public function hasProductURDataTest(): int|array
|
||||
{
|
||||
$count = $this->objectModel->hasProductURData();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
return $count;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
/**
|
||||
|
||||
title=测试 customModel->hasProductURData();
|
||||
timeout=0
|
||||
cid=1
|
||||
|
||||
*/
|
||||
|
||||
include dirname(__FILE__, 5) . '/test/lib/init.php';
|
||||
include dirname(__FILE__, 2) . '/custom.class.php';
|
||||
|
||||
zdTable('story')->gen(0);
|
||||
zdTable('user')->gen(5);
|
||||
su('admin');
|
||||
|
||||
$customTester = new customTest();
|
||||
r($customTester->hasProductURDataTest()) && p() && e('0'); // 测试系统中无用户需求数据
|
||||
|
||||
$storyTable = zdTable('story');
|
||||
$storyTable->type->range('requirement');
|
||||
$storyTable->deleted->range('0');
|
||||
$storyTable->gen(5);
|
||||
r($customTester->hasProductURDataTest()) && p() && e('5'); // 测试系统中有用户需求数据
|
||||
Reference in New Issue
Block a user