ai-refactor(flow): 调整抽象流程节点实现和依赖路径
- 修改 AbstractProcessNode 中 ProcessContext 的命名空间引用为 app\flow\context\ProcessContext - 引入 app\flow\vo\CanHandleResult 用于节点处理结果表示 - 更新前置策略执行后对成功状态的判断,改为调用 isSuccess() 方法 - 增加日志记录细节,便于调试策略执行中断时的错误信息 - 优化代码注释,提升代码可读性和维护性
This commit is contained in:
@@ -0,0 +1,96 @@
|
||||
<?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, '不同内镜机洗应有不同批次号');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user