TestOpenHandlerCommand.php 937 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. namespace App\Module\Mex\Commands;
  3. use App\Module\Mex\Tests\OpenHandlerTest;
  4. use Illuminate\Console\Command;
  5. /**
  6. * 测试OpenHandler功能的命令
  7. */
  8. class TestOpenHandlerCommand extends Command
  9. {
  10. /**
  11. * 命令签名
  12. *
  13. * @var string
  14. */
  15. protected $signature = 'mex:test-open-handler';
  16. /**
  17. * 命令描述
  18. *
  19. * @var string
  20. */
  21. protected $description = '测试Mex模块OpenHandler功能';
  22. /**
  23. * 执行命令
  24. *
  25. * @return int
  26. */
  27. public function handle()
  28. {
  29. $this->info('开始测试Mex模块OpenHandler功能...');
  30. // 运行测试
  31. $success = OpenHandlerTest::runAll();
  32. if ($success) {
  33. $this->info('所有测试通过!');
  34. return Command::SUCCESS;
  35. } else {
  36. $this->error('部分测试失败!');
  37. return Command::FAILURE;
  38. }
  39. }
  40. }