refactor generate command help test

This commit is contained in:
sunxyw
2022-03-29 18:15:13 +08:00
committed by Jerry Ma
parent 35385f8916
commit 37a92e03c1

View File

@@ -6,6 +6,7 @@ namespace Tests\ZM\Utils;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use ZM\Annotation\CQ\CQCommand; use ZM\Annotation\CQ\CQCommand;
use ZM\API\CQ;
use ZM\Event\EventManager; use ZM\Event\EventManager;
use ZM\Utils\DataProvider; use ZM\Utils\DataProvider;
use ZM\Utils\MessageUtil; use ZM\Utils\MessageUtil;
@@ -44,14 +45,13 @@ class MessageUtilTest extends TestCase
public function testGenerateCommandHelp(): void public function testGenerateCommandHelp(): void
{ {
// 因为内部使用了 WorkerCache而我们暂时无法模拟 WorkerCache所以此处无法进行测试 EventManager::$events[CQCommand::class] = [];
// EventManager::$events[CQCommand::class] = [ $cmd = new CQCommand('测试命令');
// new CQCommand('测试命令'), $cmd->class = self::class;
// new CQCommand('测试命令2', '执行命令*'), $cmd->method = __FUNCTION__;
// ]; EventManager::addEvent(CQCommand::class, $cmd);
// $help = MessageUtil::generateCommandHelp(); $help = MessageUtil::generateCommandHelp();
// $this->assertEquals('测试命令', $help[0]); $this->assertEquals('测试命令:无描述', $help[0]);
$this->assertTrue(true);
} }
/** /**