init
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace tests\db;
|
||||
|
||||
use app\model\EctUser;
|
||||
use app\utils\Logger;
|
||||
use app\utils\ModelAutoGenerator;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use support\Db;
|
||||
|
||||
class DBC extends TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* 测试数据库连接性
|
||||
*/
|
||||
public function testDBConnect()
|
||||
{
|
||||
$db = Db::schema('mysql')->getConnection();
|
||||
$this->assertNotNull($db);
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试生成所有表
|
||||
*/
|
||||
// public function testGenTables()
|
||||
// {
|
||||
// $result = ModelAutoGenerator::generate_all(true);
|
||||
//
|
||||
// // 2. 断言返回结果结构正确
|
||||
// $this->assertArrayHasKey('success', $result, '批量生成结果缺少 success 字段');
|
||||
// $this->assertArrayHasKey('fail', $result, '批量生成结果缺少 fail 字段');
|
||||
// // 3. 断言 success 是整数类型
|
||||
// $this->assertIsInt($result['success'], 'success 字段不是整数');
|
||||
// // 4. 断言 fail 是数组类型
|
||||
// $this->assertIsArray($result['fail'], 'fail 字段不是数组');
|
||||
// // 5. 断言 fail 数组是空的
|
||||
// if (!empty($result['fail'])){
|
||||
// foreach ($result['fail'] as $key => $value){
|
||||
// Logger::error($value['table']."表生成失败:".$value['reason']);
|
||||
// }
|
||||
// }
|
||||
// $this->assertEmpty($result['fail'], 'fail 数组不是空的,说明有表生成失败');
|
||||
// }
|
||||
|
||||
public function testModel()
|
||||
{
|
||||
$users = EctUser::all();
|
||||
$this->assertNotEmpty($users, '用户列表不能为空');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
{
|
||||
"description": "虚拟测试环境默认配置",
|
||||
"version": "1.0",
|
||||
|
||||
"readers": {
|
||||
"清洗": {
|
||||
"no": "R001",
|
||||
"id": "1",
|
||||
"type": "清洗"
|
||||
},
|
||||
"漂洗": {
|
||||
"no": "R002",
|
||||
"id": "2",
|
||||
"type": "漂洗"
|
||||
},
|
||||
"消毒": {
|
||||
"no": "R003",
|
||||
"id": "3",
|
||||
"type": "消毒"
|
||||
},
|
||||
"终末漂洗": {
|
||||
"no": "R004",
|
||||
"id": "4",
|
||||
"type": "终末漂洗"
|
||||
},
|
||||
"干燥": {
|
||||
"no": "R005",
|
||||
"id": "5",
|
||||
"type": "干燥"
|
||||
},
|
||||
"机洗": {
|
||||
"no": "R006",
|
||||
"id": "6",
|
||||
"type": "机洗"
|
||||
},
|
||||
"存储": {
|
||||
"no": "R007",
|
||||
"id": "7",
|
||||
"type": "存储"
|
||||
},
|
||||
"未绑定": {
|
||||
"no": "R999",
|
||||
"id": "",
|
||||
"type": ""
|
||||
}
|
||||
},
|
||||
|
||||
"endoscopes": {
|
||||
"胃镜1": {
|
||||
"id": "E001",
|
||||
"name": "胃镜1号",
|
||||
"cardNo": "CARD_E001",
|
||||
"type": "胃镜"
|
||||
},
|
||||
"肠镜1": {
|
||||
"id": "E002",
|
||||
"name": "肠镜1号",
|
||||
"cardNo": "CARD_E002",
|
||||
"type": "肠镜"
|
||||
},
|
||||
"未绑定卡": {
|
||||
"id": "",
|
||||
"name": "",
|
||||
"cardNo": "CARD_UNKNOWN",
|
||||
"type": ""
|
||||
}
|
||||
},
|
||||
|
||||
"operators": {
|
||||
"操作员1": {
|
||||
"id": "U001",
|
||||
"name": "张三",
|
||||
"rfid": "RFID_U001"
|
||||
},
|
||||
"操作员2": {
|
||||
"id": "U002",
|
||||
"name": "李四",
|
||||
"rfid": "RFID_U002"
|
||||
}
|
||||
},
|
||||
|
||||
"config": {
|
||||
"machineId": "01",
|
||||
"morningWashStartTime": "06:00:00",
|
||||
"morningWashMode": "standard"
|
||||
},
|
||||
|
||||
"stepDurations": {
|
||||
"清洗": 60,
|
||||
"漂洗": 60,
|
||||
"消毒": 180,
|
||||
"终末漂洗": 60,
|
||||
"干燥": 60
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user