addRegisterPath(WORKING_DIR . "/src/Module/", "Module"); try { $parser->registerMods(); } catch (ReflectionException $e) { throw $e; } EventManager::loadEventByParser($parser); $dispatcher = new EventDispatcher(CQCommand::class); $dispatcher->setReturnFunction(function ($result) { echo $result . PHP_EOL; }); //$dispatcher->setRuleFunction(function ($v) { return $v->match == "qwe"; }); $dispatcher->setRuleFunction(function ($v) { return $v->match == "你好"; }); //$dispatcher->setRuleFunction(fn ($v) => $v->match == "qwe"); ob_start(); try { $dispatcher->dispatchEvents(); } catch (AnnotationException $e) { } $r = ob_get_clean(); echo $r; $this->assertStringContainsString("你好啊", $r); } }