+ Add custom::hasProductURData unit test.

This commit is contained in:
tianshujie
2023-11-23 10:22:54 +08:00
parent fec2fcf37e
commit af154c4b4e
2 changed files with 40 additions and 0 deletions
+15
View File
@@ -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'); // 测试系统中有用户需求数据