2022-03-28 16:42:13 +08:00

30 lines
720 B
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
namespace ZMTest\Testing;
use Module\Example\Hello;
use PHPUnit\Framework\TestCase;
use ZM\Config\ZMConfig;
use ZM\ConsoleApplication;
use ZM\Utils\ZMUtil;
class ModuleTest extends TestCase
{
protected function setUp(): void {
ZMConfig::setDirectory(realpath(__DIR__."/../Mock"));
set_coroutine_params([]);
(new ConsoleApplication('zhamao-test'))->initEnv();
require_once __DIR__ . '/../../../src/ZM/global_defines.php';
}
public function testCtx() {
$r = ZMUtil::getModInstance(Hello::class);
ob_start();
$r->randNum(["随机数", "1", "5"]);
$out = ob_get_clean();
$this->assertEquals("随机数是1\n", $out);
}
}