+ [misc] Add unit tests for productZen::saveAndModifyCookie4Browse() method
🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
committed by
sunhao
co-authored by
Claude
parent
3a991389ec
commit
5d04fa6c45
@@ -2337,4 +2337,48 @@ class productZenTest extends baseTest
|
||||
|
||||
return $sendData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test saveAndModifyCookie4Browse method.
|
||||
*
|
||||
* @param int $productID
|
||||
* @param string $branch
|
||||
* @param int $param
|
||||
* @param string $browseType
|
||||
* @param string $orderBy
|
||||
* @param string $preProductID
|
||||
* @param string $preBranch
|
||||
* @param string $storyModule
|
||||
* @param string $tab
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function saveAndModifyCookie4BrowseTest(int $productID = 0, string $branch = '', int $param = 0, string $browseType = '', string $orderBy = 'id_desc', string $preProductID = '', string $preBranch = '', string $storyModule = '', string $tab = 'product')
|
||||
{
|
||||
/* Set up cookie values. */
|
||||
if($preProductID !== '') $_COOKIE['preProductID'] = $preProductID;
|
||||
if($preBranch !== '') $_COOKIE['preBranch'] = $preBranch;
|
||||
if($storyModule !== '') $_COOKIE['storyModule'] = $storyModule;
|
||||
|
||||
/* Set app tab. */
|
||||
$this->instance->app->tab = $tab;
|
||||
|
||||
/* Call the method. */
|
||||
$this->invokeArgs('saveAndModifyCookie4Browse', array($productID, $branch, $param, $browseType, $orderBy));
|
||||
|
||||
/* Get the cookie values after method execution. */
|
||||
$result = array(
|
||||
'storyModule' => isset($_COOKIE['storyModule']) ? $_COOKIE['storyModule'] : '',
|
||||
'storyModuleParam' => isset($_COOKIE['storyModuleParam']) ? $_COOKIE['storyModuleParam'] : '',
|
||||
'storyBranch' => isset($_COOKIE['storyBranch']) ? $_COOKIE['storyBranch'] : '',
|
||||
'treeBranch' => isset($_COOKIE['treeBranch']) ? $_COOKIE['treeBranch'] : '',
|
||||
'productStoryOrder' => isset($_COOKIE['productStoryOrder']) ? $_COOKIE['productStoryOrder'] : '',
|
||||
'preProductID' => isset($_COOKIE['preProductID']) ? $_COOKIE['preProductID'] : '',
|
||||
'preBranch' => isset($_COOKIE['preBranch']) ? $_COOKIE['preBranch'] : ''
|
||||
);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user