+ [misc] Add unit tests for docModel::setLastViewed() method
🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -2208,4 +2208,19 @@ class docTest
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test setLastViewed method.
|
||||
*
|
||||
* @param array $value
|
||||
* @access public
|
||||
* @return mixed
|
||||
*/
|
||||
public function setLastViewedTest(array $value): mixed
|
||||
{
|
||||
$this->objectModel->setLastViewed($value);
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Executable
+29
@@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
/**
|
||||
|
||||
title=测试 docModel::setLastViewed();
|
||||
timeout=0
|
||||
cid=0
|
||||
|
||||
- 执行docTest模块的setLastViewedTest方法,参数是array @1
|
||||
- 执行docTest模块的setLastViewedTest方法,参数是array @1
|
||||
- 执行docTest模块的setLastViewedTest方法,参数是array @1
|
||||
- 执行docTest模块的setLastViewedTest方法,参数是array @1
|
||||
- 执行docTest模块的setLastViewedTest方法,参数是array @1
|
||||
|
||||
*/
|
||||
|
||||
include dirname(__FILE__, 5) . '/test/lib/init.php';
|
||||
include dirname(__FILE__, 2) . '/lib/doc.unittest.class.php';
|
||||
|
||||
su('admin');
|
||||
|
||||
$docTest = new docTest();
|
||||
|
||||
r($docTest->setLastViewedTest(array('lastViewedSpace' => '1', 'lastViewedSpaceHome' => '2', 'lastViewedLib' => '3'))) && p() && e('1');
|
||||
r($docTest->setLastViewedTest(array('lastViewedSpace' => '4', 'otherKey' => 'ignore'))) && p() && e('1');
|
||||
r($docTest->setLastViewedTest(array())) && p() && e('1');
|
||||
r($docTest->setLastViewedTest(array('invalidKey' => 'value', 'lastViewedLib' => '5'))) && p() && e('1');
|
||||
r($docTest->setLastViewedTest(array('lastViewedSpace' => 'special<>&"value', 'lastViewedSpaceHome' => '6'))) && p() && e('1');
|
||||
Reference in New Issue
Block a user