+ [misc] Add unit tests for backupModel::backSQL() method
🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
declare(strict_types = 1);
|
||||
class backupTest
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
global $tester;
|
||||
$this->objectModel = $tester->loadModel('backup');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test backSQL method.
|
||||
*
|
||||
* @param string $backupFile
|
||||
* @access public
|
||||
* @return mixed
|
||||
*/
|
||||
public function backSQLTest($backupFile = null)
|
||||
{
|
||||
$result = $this->objectModel->backSQL($backupFile);
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
Executable
+29
@@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
/**
|
||||
|
||||
title=测试 backupModel::backSQL();
|
||||
timeout=0
|
||||
cid=0
|
||||
|
||||
- 执行backupTest模块的backSQLTest方法,参数是'/tmp/test_backup' 属性result @1
|
||||
- 执行backupTest模块的backSQLTest方法,参数是'backup/test.sql' 属性result @~~
|
||||
- 执行backupTest模块的backSQLTest方法,参数是'/tmp/zentao_backup.sql' 属性result @1
|
||||
- 执行backupTest模块的backSQLTest方法,参数是'/tmp/very_long_backup_file_name_for_testing_purpose.sql' 属性result @1
|
||||
- 执行backupTest模块的backSQLTest方法,参数是'/tmp/backup_测试-2024.sql' 属性result @1
|
||||
|
||||
*/
|
||||
|
||||
include dirname(__FILE__, 5) . '/test/lib/init.php';
|
||||
include dirname(__FILE__, 2) . '/lib/backup.unittest.class.php';
|
||||
|
||||
su('admin');
|
||||
|
||||
$backupTest = new backupTest();
|
||||
|
||||
r($backupTest->backSQLTest('/tmp/test_backup')) && p('result') && e('1');
|
||||
r($backupTest->backSQLTest('backup/test.sql')) && p('result') && e('~~');
|
||||
r($backupTest->backSQLTest('/tmp/zentao_backup.sql')) && p('result') && e('1');
|
||||
r($backupTest->backSQLTest('/tmp/very_long_backup_file_name_for_testing_purpose.sql')) && p('result') && e('1');
|
||||
r($backupTest->backSQLTest('/tmp/backup_测试-2024.sql')) && p('result') && e('1');
|
||||
Reference in New Issue
Block a user