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, '不同内镜机洗应有不同批次号'); } }