+ [misc] Add unit tests for settingModel::computeSN() method

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
liugang
2025-09-15 15:06:23 +08:00
co-authored by Claude
parent 9240a48743
commit ddf98bfaa4
2 changed files with 41 additions and 0 deletions
@@ -261,4 +261,18 @@ class settingTest
return $objects;
}
/**
* Test compute SN method.
*
* @access public
* @return string
*/
public function computeSNTest()
{
$result = $this->objectModel->computeSN();
if(dao::isError()) return dao::getError();
return $result;
}
}
+27
View File
@@ -0,0 +1,27 @@
#!/usr/bin/env php
<?php
/**
title=测试 settingModel::computeSN();
timeout=0
cid=0
- 执行settingTest模块的computeSNTest方法 @32
- 执行/', $settingTest模块的computeSNTest方法 @1
- 执行settingTest模块的computeSNTest方法 @1
*/
include dirname(__FILE__, 5) . '/test/lib/init.php';
include dirname(__FILE__, 2) . '/lib/setting.unittest.class.php';
su('admin');
$settingTest = new settingTest();
r(strlen($settingTest->computeSNTest())) && p() && e('32');
r(preg_match('/^[a-f0-9]{32}$/', $settingTest->computeSNTest())) && p() && e('1');
$sn1 = $settingTest->computeSNTest(); $sn2 = $settingTest->computeSNTest(); r($sn1 != $sn2) && p() && e('1');
r(ctype_xdigit($settingTest->computeSNTest())) && p() && e('1');
$result = $settingTest->computeSNTest(); r(!empty($result)) && p() && e('1');