* [task#135722,done,1h,0h] Add test case.
This commit is contained in:
@@ -666,16 +666,16 @@ class instance extends control
|
||||
*/
|
||||
public function cronCleanBackup()
|
||||
{
|
||||
if(!$this->config->inQuickon) return $this->send(array('result' => 'success', 'message' => zget($this->lang->instance->notices, 'NoCleanBackupFiles')));
|
||||
if(!$this->config->inQuickon) return $this->send(array('result' => 'success', 'message' => $this->lang->instance->notices['NoCleanBackupFiles']));
|
||||
|
||||
/* Init instance list. */
|
||||
$instances = $this->loadModel('space')->getSpaceInstances(0, 'running');
|
||||
if(empty($instances)) return $this->send(array('result' => 'success', 'message' => zget($this->lang->instance->notices, 'NoCleanBackupFiles')));
|
||||
if(empty($instances)) return $this->send(array('result' => 'success', 'message' => $this->lang->instance->notices['NoCleanBackupFiles']));
|
||||
|
||||
/* Cycle cleaning backup. */
|
||||
foreach($instances as $instance) $this->instance->cleanBackup($instance);
|
||||
|
||||
return $this->send(array('result' => 'success', 'message' => zget($this->lang->instance->notices, 'cleanBackupSuccess')));
|
||||
return $this->send(array('result' => 'success', 'message' => $this->lang->instance->notices['cleanBackupSuccess']));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . '/test/lib/init.php';
|
||||
su('admin');
|
||||
|
||||
zenData('instance')->gen(5);
|
||||
|
||||
/**
|
||||
|
||||
title=instanceModel->getByName();
|
||||
timeout=0
|
||||
cid=1
|
||||
|
||||
- 查看获取到的第一条instance
|
||||
- 查询 禅道开源版 是否存在 @禅道开源版
|
||||
- 查询 禅道旗舰版 是否存在 @禅道旗舰版
|
||||
- 查询 禅道企业版 是否存在 @禅道企业版
|
||||
- 查询 解决方案3 是否存在 @0
|
||||
- 查询 解决方案1 是否存在 @0
|
||||
*/
|
||||
|
||||
global $tester;
|
||||
$tester->loadModel('instance');
|
||||
|
||||
$instance = $tester->instance->getByName('禅道开源版');
|
||||
r($instance) && p('name') && e('0');
|
||||
|
||||
$instance = $tester->instance->getByName('禅道旗舰版');
|
||||
r($instance) && p('name') && e('0');
|
||||
|
||||
$instance = $tester->instance->getByName('禅道企业版');
|
||||
r($instance) && p('name') && e('0');
|
||||
|
||||
$instance = $tester->instance->getByName('解决方案3');
|
||||
r(empty($instance)) && p('1') && e('1');
|
||||
|
||||
$instance = $tester->instance->getByName('解决方案1');
|
||||
r(empty($instance)) && p('1') && e('1');
|
||||
Reference in New Issue
Block a user