2022-05-04 21:31:38 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
|
|
namespace Tests\ZM\Utils;
|
|
|
|
|
|
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
|
use Throwable;
|
|
|
|
|
use ZM\Console\Console;
|
|
|
|
|
use ZM\Utils\Terminal;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @internal
|
|
|
|
|
*/
|
|
|
|
|
class TerminalTest extends TestCase
|
|
|
|
|
{
|
|
|
|
|
public function testInit()
|
|
|
|
|
{
|
2022-06-09 00:25:17 +08:00
|
|
|
$this->markTestIncomplete('logger level change in need');
|
2022-05-04 21:31:38 +08:00
|
|
|
Console::setLevel(4);
|
|
|
|
|
Terminal::init();
|
2022-05-04 22:30:56 +08:00
|
|
|
Console::setLevel(0);
|
2022-05-04 22:25:42 +08:00
|
|
|
$this->expectOutputRegex('/Initializing\ Terminal/');
|
2022-05-04 21:31:38 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @throws Throwable
|
|
|
|
|
*/
|
|
|
|
|
public function testExecuteCommand()
|
|
|
|
|
{
|
2022-06-09 00:25:17 +08:00
|
|
|
$this->markTestIncomplete('logger level change in need');
|
2022-05-04 21:31:38 +08:00
|
|
|
Console::setLevel(2);
|
|
|
|
|
Terminal::executeCommand('echo zhamao-framework');
|
2022-05-04 22:30:56 +08:00
|
|
|
Console::setLevel(0);
|
2022-05-04 22:25:42 +08:00
|
|
|
$this->expectOutputRegex('/zhamao-framework/');
|
2022-05-04 21:31:38 +08:00
|
|
|
}
|
|
|
|
|
}
|