* [misc] Enhance unit tests for backupModel::getBackupPath() method
🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -538,6 +538,20 @@ class backupTest
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test getBackupPath method.
|
||||
*
|
||||
* @access public
|
||||
* @return mixed
|
||||
*/
|
||||
public function getBackupPathTest()
|
||||
{
|
||||
$result = $this->objectModel->getBackupPath();
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean up test directory.
|
||||
*
|
||||
|
||||
Regular → Executable
+26
-6
@@ -1,20 +1,40 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . '/test/lib/init.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=backupModel->getBackupPath();
|
||||
title=测试 backupModel::getBackupPath();
|
||||
timeout=0
|
||||
cid=1
|
||||
cid=0
|
||||
|
||||
- 执行backupTest模块的getBackupPathTest方法,参数是, '/tmp/backup/') !== false @1
|
||||
- 执行backupTest模块的getBackupPathTest方法,参数是, 'module/backup/test/model/backup/') !== false @1
|
||||
- 执行backupTest模块的getBackupPathTest方法 @/test/backup/
|
||||
- 执行backupTest模块的getBackupPathTest方法 @C:\test\backup\/
|
||||
- 执行backupTest模块的getBackupPathTest方法 @/test path/backup with spaces/
|
||||
|
||||
*/
|
||||
|
||||
include dirname(__FILE__, 5) . '/test/lib/init.php';
|
||||
include dirname(__FILE__, 2) . '/lib/backup.unittest.class.php';
|
||||
|
||||
su('admin');
|
||||
|
||||
$backupTest = new backupTest();
|
||||
|
||||
global $tester;
|
||||
$backupModel = $tester->loadModel('backup');
|
||||
|
||||
r(strpos($backupModel->getBackupPath(), '/tmp/backup/') !== false) && p() && e('1'); //默认备份路径。
|
||||
r(strpos($backupTest->getBackupPathTest(), '/tmp/backup/') !== false) && p() && e('1');
|
||||
|
||||
$backupModel->config->backup->settingDir = dirname(__FILE__) . DS . 'backup' . DS;
|
||||
r(strpos($backupModel->getBackupPath(), 'module/backup/test/model/backup/') !== false) && p() && e('1'); //设置备份路径。
|
||||
r(strpos($backupTest->getBackupPathTest(), 'module/backup/test/model/backup/') !== false) && p() && e('1');
|
||||
|
||||
$backupModel->config->backup->settingDir = '/test/backup//';
|
||||
r($backupTest->getBackupPathTest()) && p() && e('/test/backup/');
|
||||
|
||||
$backupModel->config->backup->settingDir = 'C:\\test\\backup\\';
|
||||
r($backupTest->getBackupPathTest()) && p() && e('C:\test\backup\/');
|
||||
|
||||
$backupModel->config->backup->settingDir = '/test path/backup with spaces/';
|
||||
r($backupTest->getBackupPathTest()) && p() && e('/test path/backup with spaces/');
|
||||
Reference in New Issue
Block a user