Files
tcpserver-flow/tests/flow/node_flow/MachineWashTest.php
T
zimoyin 6c874221ad ai-chore(config): 调整流程配置及改进测试代码
- 将 FLOW_USE_CUSTOM_PROCESS 从 true 改为 false,禁用自定义流程
- 在 BlockTest 测试用例中改用 setBlockMode 方法设置阻断模式
- 设置统一的错误处理,将错误转为异常抛出
- 重命名 BlockTest 测试文件路径,优化测试组织结构
- 更新 IDE php include paths,调整依赖包引用顺序
- 删除无用的 tests/flow/Test.php 测试文件
- 微调 start.php、webman、windows.php 配置或代码模块
2026-03-11 03:59:57 +08:00

97 lines
2.7 KiB
PHP

<?php
namespace tests\flow\cases;
use tests\flow\TestCase;
use tests\flow\VirtualityFlowProcessor;
/**
* 机洗流程测试
*
* 覆盖场景:
* 3. 机洗流程
* 4. 晨洗 + 机洗流程
*/
class MachineWashTest extends TestCase
{
private VirtualityFlowProcessor $processor;
protected function setUp(): void
{
parent::setUp();
$this->processor = VirtualityFlowProcessor::createMachineWash();
}
protected function tearDown(): void
{
parent::tearDown();
$this->processor->reset();
}
// ==================== 3. 机洗流程 ====================
/**
* 测试机洗流程
*/
public function testMachineWashProcess(): void
{
$result = $this->processor->swipe('操作员1', '胃镜1', '机洗');
$this->assertSuccess($result, '机洗应成功');
$this->assertStep($result, '机洗');
$this->assertHasBatchNo($result);
$this->assertTrue($result->isSuccess(), 'isSuccess() 应为 true');
}
/**
* 测试机洗流程使用便捷方法
*/
public function testMachineWashProcessUsingHelper(): void
{
$result = $this->processor->executeMachineWash('操作员1', '肠镜1');
$this->assertSuccess($result, '机洗应成功');
$this->assertStep($result, '机洗');
$this->assertTrue($result->isSuccess(), 'isSuccess() 应为 true');
}
// ==================== 4. 晨洗 + 机洗流程 ====================
/**
* 测试晨洗后接机洗流程
*/
public function testMorningWashThenMachineWash(): void
{
$operator = '操作员1';
$endoscope = '胃镜1';
// 直接执行机洗(假设晨洗已完成)
$result = $this->processor->swipe($operator, $endoscope, '机洗');
$this->assertSuccess($result, '晨洗后机洗应成功');
$this->assertStep($result, '机洗');
$this->assertTrue($result->isSuccess(), 'isSuccess() 应为 true');
}
/**
* 测试多个内镜同时机洗
*/
public function testMultipleEndoscopeMachineWash(): void
{
$operator = '操作员1';
// 胃镜1机洗
$result1 = $this->processor->swipe($operator, '胃镜1', '机洗');
$this->assertSuccess($result1);
$batchNo1 = $result1->getBatchNo();
// 肠镜1机洗
$result2 = $this->processor->swipe($operator, '肠镜1', '机洗');
$this->assertSuccess($result2);
$batchNo2 = $result2->getBatchNo();
// 批次号应不同
$this->assertNotEquals($batchNo1, $batchNo2, '不同内镜机洗应有不同批次号');
}
}