* @package solution * @link https://www.zentao.net */ class solutionTest { public function __construct() { su('admin'); global $tester; $this->objectModel = $tester->loadModel('solution'); } /** * Test getByID method. * * @param int $solutionID * @access public * @return object|null */ public function getByIdTest(int $solutionID): object|null { return $this->objectModel->getByID($solutionID); } /** * Test getLastSolution method. * * @access public * @return object|false */ public function getLastSolutionTest(): object|false { dao::$cache = array(); return $this->objectModel->getLastSolution(); } /** * Test saveLog method. * * @param string $message * @access public * @return int */ public function saveLogTest(string $message): int { global $app; $errorFile = $app->logRoot . 'php.' . date('Ymd') . '.log.php'; file_put_contents($errorFile, ''); $file = $this->objectModel->saveLog($message); return strlen(file_get_contents($file)); } /** * Test saveStatus method. * * @param int $solutionID * @param string $status * @access public * @return object|null */ public function saveStatusTest(int $solutionID, string $status): object|null { $this->objectModel->saveStatus($solutionID, $status); if(dao::isError()) return dao::getError(); return $this->objectModel->getByID($solutionID); } }