diff --git a/module/testcase/lang/en.php b/module/testcase/lang/en.php index af9c3a0f36..59ee41512e 100644 --- a/module/testcase/lang/en.php +++ b/module/testcase/lang/en.php @@ -220,6 +220,7 @@ $lang->testcase->resultList['blocked'] = 'Blocked'; $lang->testcase->buttonToList = 'Back'; +$lang->testcase->stepsEmpty = 'Case %s step cannot be empty.'; $lang->testcase->errorEncode = 'No data. Please select right encoding and upload again!'; $lang->testcase->noFunction = 'Iconv and mb_convert_encoding are not found. You cannot convert the data to the encoding you want!'; $lang->testcase->noRequire = "Row %s has“%s ”which is a required field and it should not be blank."; diff --git a/module/testcase/lang/zh-cn.php b/module/testcase/lang/zh-cn.php index 390bfe3773..fbf7c0b489 100644 --- a/module/testcase/lang/zh-cn.php +++ b/module/testcase/lang/zh-cn.php @@ -220,6 +220,7 @@ $lang->testcase->resultList['blocked'] = '阻塞'; $lang->testcase->buttonToList = '返回'; +$lang->testcase->stepsEmpty = '用例%s步骤不能为空'; $lang->testcase->errorEncode = '无数据,请选择正确的编码重新上传!'; $lang->testcase->noFunction = '不存在iconv和mb_convert_encoding转码方法,不能将数据转成想要的编码!'; $lang->testcase->noRequire = "%s行的“%s”是必填字段,不能为空"; diff --git a/module/testcase/model.php b/module/testcase/model.php index 7e70e5a935..8c5f155aad 100644 --- a/module/testcase/model.php +++ b/module/testcase/model.php @@ -39,6 +39,17 @@ class testcaseModel extends model */ function create($bugID) { + $steps = $this->post->steps; + $expects = $this->post->expects; + foreach($expects as $key => $value) + { + if(empty($steps[$key])) + { + dao::$errors[] = sprintf($this->lang->testcase->stepsEmpty, $key); + return false; + } + } + $now = helper::now(); $status = $this->getStatus('create'); $case = fixer::input('post') @@ -705,6 +716,17 @@ class testcaseModel extends model */ public function update($caseID, $testtasks = array()) { + $steps = $this->post->steps; + $expects = $this->post->expects; + foreach($expects as $key => $value) + { + if(empty($steps[$key])) + { + dao::$errors[] = sprintf($this->lang->testcase->stepsEmpty, $key); + return false; + } + } + $now = helper::now(); $oldCase = $this->getById($caseID);