processor = VirtualityFlowProcessor::createStandard(); } protected function tearDown(): void { parent::tearDown(); $this->processor->reset(); } /** * 测试 VirtualityFlowProcessor 状态重置 */ public function testProcessorReset(): void { // 执行一些操作 $this->processor->swipe('操作员1', '胃镜1', '清洗'); // 重置 $this->processor->reset(); // 重置后应该是新流程 $history = $this->processor->getHistory(); $this->assertEmpty($history, '重置后历史应为空'); } /** * 测试 VirtualContextBuilder 功能 */ public function testVirtualContextBuilder(): void { $builder = VirtualContextBuilder::create(); $context = $builder ->endoscope('胃镜1') ->reader('清洗') ->operator('操作员1') ->currentStep('清洗') ->batchNo('20260310010001') ->build(); $this->assertEquals('清洗', $context->getCurrentStep()); $this->assertEquals('20260310010001', $context->getBatchNo()); $this->assertEquals('张三', $context->getOperator()->name); $this->assertEquals('胃镜1号', $context->getEndoscope()->name); } /** * 测试环境配置加载 */ public function testEnvironmentConfig(): void { $env = $this->processor->getEnvironment(); $this->assertArrayHasKey('readers', $env); $this->assertArrayHasKey('endoscopes', $env); $this->assertArrayHasKey('operators', $env); $this->assertArrayHasKey('config', $env); } }