🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
92 lines
2.3 KiB
PHP
Executable File
92 lines
2.3 KiB
PHP
Executable File
<?php
|
|
declare(strict_types = 1);
|
|
class hostTest
|
|
{
|
|
public function __construct()
|
|
{
|
|
global $tester;
|
|
$this->objectModel = $tester->loadModel('host');
|
|
$this->tester = $tester;
|
|
$tester->app->setModuleName('host');
|
|
|
|
$this->hostZenTest = initReference('host');
|
|
}
|
|
|
|
/**
|
|
* Test getPairs method.
|
|
*
|
|
* @param string $moduleIdList
|
|
* @param string $status
|
|
* @access public
|
|
* @return array
|
|
*/
|
|
public function getPairsTest($moduleIdList = '', $status = '')
|
|
{
|
|
$result = $this->objectModel->getPairs($moduleIdList, $status);
|
|
if(dao::isError()) return dao::getError();
|
|
|
|
return $result;
|
|
}
|
|
|
|
/**
|
|
* Test processTreemap method.
|
|
*
|
|
* @param array $datas
|
|
* @access public
|
|
* @return array
|
|
*/
|
|
public function processTreemapTest($datas = array())
|
|
{
|
|
$reflection = new ReflectionClass($this->objectModel);
|
|
$method = $reflection->getMethod('processTreemap');
|
|
$method->setAccessible(true);
|
|
|
|
$result = $method->invoke($this->objectModel, $datas);
|
|
if(dao::isError()) return dao::getError();
|
|
|
|
return $result;
|
|
}
|
|
|
|
/**
|
|
* Test getTreeModules method.
|
|
*
|
|
* @param int $rootID
|
|
* @param array $hosts
|
|
* @access public
|
|
* @return array
|
|
*/
|
|
public function getTreeModulesTest($rootID = 0, $hosts = array())
|
|
{
|
|
$reflection = new ReflectionClass($this->objectModel);
|
|
$method = $reflection->getMethod('getTreeModules');
|
|
$method->setAccessible(true);
|
|
|
|
$result = $method->invoke($this->objectModel, $rootID, $hosts);
|
|
if(dao::isError()) return dao::getError();
|
|
|
|
return $result;
|
|
}
|
|
|
|
/**
|
|
* Test checkFormData method.
|
|
*
|
|
* @param object $formData
|
|
* @access public
|
|
* @return mixed
|
|
*/
|
|
public function checkFormDataTest($formData)
|
|
{
|
|
$method = $this->hostZenTest->getMethod('checkFormData');
|
|
$method->setAccessible(true);
|
|
|
|
dao::$errors = array();
|
|
$result = $method->invokeArgs($this->hostZenTest->newInstance(), array($formData));
|
|
|
|
if(dao::isError())
|
|
{
|
|
return dao::getError();
|
|
}
|
|
|
|
return $result;
|
|
}
|
|
} |