From ec041a41688d715286b895201a688e980a4456d5 Mon Sep 17 00:00:00 2001 From: qiyu-xie Date: Thu, 3 Jun 2021 10:00:48 +0800 Subject: [PATCH] * Add getById method testcase of trainplan module. --- test/model/trainplan/getbyid.php | 23 +++++++++++++++ test/zendata/trainplan.yaml | 48 ++++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+) create mode 100755 test/model/trainplan/getbyid.php create mode 100644 test/zendata/trainplan.yaml diff --git a/test/model/trainplan/getbyid.php b/test/model/trainplan/getbyid.php new file mode 100755 index 0000000000..b187c6e528 --- /dev/null +++ b/test/model/trainplan/getbyid.php @@ -0,0 +1,23 @@ +#!/usr/bin/env php +> `21,hufangzhou` +[esac] +*/ +$trainplan = $tester->loadModel('trainplan'); + +$app->dbh->query("truncate zt_trainplan"); +zdImport(TABLE_TRAINPLAN, "zendata/trainplan.yaml", 10); + +$randTrainPlan = $tester->dao->select('*,rand() as rand')->from(TABLE_TRAINPLAN)->orderBy('rand')->fetch(); +if(!$randTrainPlan) exit("Prepair data error."); +unset($randTrainPlan->rand); + +/* Step 1.*/ +run($trainplan->getById($randTrainPlan->id)) and expect('project,lecturer'); diff --git a/test/zendata/trainplan.yaml b/test/zendata/trainplan.yaml new file mode 100644 index 0000000000..0b22ca0ebf --- /dev/null +++ b/test/zendata/trainplan.yaml @@ -0,0 +1,48 @@ +title: 'table zt_trainplan ' +desc: "" +author: automated export +version: "1.0" +fields: + - field: id + range: 1-10 + - field: project + range: 21 + - field: name + range: 1-10 + format: "培训计划_%d" + - field: begin + range: "(-1M)-(+1w):60" + prefix: DateTime + type: timestamp + format: "YY/MM/DD hh:mm:ss" + - field: end + range: "(-1M)-(+1w):60" + prefix: DateTime + type: timestamp + format: "YY/MM/DD hh:mm:ss" + - field: place + range: 1-10 + format: "地点_%d" + - field: trainee + range: admin,jia,yiyi + - field: lecturer + range: hufangzhou + - field: type + range: outside,inside + - field: status + range: wait + - field: summary + range: ' ' + - field: createdBy + range: admin + - field: createdDate + range: "(-1M)-(+1w):60" + prefix: DateTime + type: timestamp + format: "YY/MM/DD hh:mm:ss" + - field: editedBy + range: ' ' + - field: editedDate + range: ' ' + - field: deleted + range: 0