🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
82 lines
2.2 KiB
PHP
82 lines
2.2 KiB
PHP
<?php
|
|
declare(strict_types = 1);
|
|
class programTest
|
|
{
|
|
public function __construct()
|
|
{
|
|
global $tester;
|
|
$this->tester = $tester;
|
|
$tester->app->setModuleName('program');
|
|
$tester->loadModel('program');
|
|
|
|
$this->objectZen = initReference('program');
|
|
}
|
|
|
|
/**
|
|
* Test getPMListByPrograms method.
|
|
*
|
|
* @param array $programs
|
|
* @access public
|
|
* @return mixed
|
|
*/
|
|
public function getPMListByProgramsTest($programs = array())
|
|
{
|
|
$method = $this->objectZen->getMethod('getPMListByPrograms');
|
|
$method->setAccessible(true);
|
|
$result = $method->invokeArgs($this->objectZen->newInstance(), array($programs));
|
|
if(dao::isError()) return dao::getError();
|
|
|
|
return $result;
|
|
}
|
|
|
|
/**
|
|
* Test buildProgramForCreate method.
|
|
*
|
|
* @access public
|
|
* @return object|array
|
|
*/
|
|
public function buildProgramForCreateTest()
|
|
{
|
|
$method = $this->objectZen->getMethod('buildProgramForCreate');
|
|
$method->setAccessible(true);
|
|
$result = $method->invokeArgs($this->objectZen->newInstance(), array());
|
|
if(dao::isError()) return dao::getError();
|
|
|
|
return $result;
|
|
}
|
|
|
|
/**
|
|
* Test buildProgramForEdit method.
|
|
*
|
|
* @param int $programID
|
|
* @access public
|
|
* @return object|array
|
|
*/
|
|
public function buildProgramForEditTest(int $programID)
|
|
{
|
|
$method = $this->objectZen->getMethod('buildProgramForEdit');
|
|
$method->setAccessible(true);
|
|
$result = $method->invokeArgs($this->objectZen->newInstance(), array($programID));
|
|
if(dao::isError()) return dao::getError();
|
|
|
|
return $result;
|
|
}
|
|
|
|
/**
|
|
* Test buildTree method.
|
|
*
|
|
* @param array $programs
|
|
* @param int $parentID
|
|
* @access public
|
|
* @return array
|
|
*/
|
|
public function buildTreeTest(array $programs, int $parentID = 0)
|
|
{
|
|
$method = $this->objectZen->getMethod('buildTree');
|
|
$method->setAccessible(true);
|
|
$result = $method->invokeArgs($this->objectZen->newInstance(), array($programs, $parentID));
|
|
if(dao::isError()) return dao::getError();
|
|
|
|
return $result;
|
|
}
|
|
} |