-
Notifications
You must be signed in to change notification settings - Fork 47
Expand file tree
/
Copy pathCommandTest.php
More file actions
57 lines (47 loc) · 1.51 KB
/
Copy pathCommandTest.php
File metadata and controls
57 lines (47 loc) · 1.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?php declare(strict_types=1);
/**
* The file is part of inhere/console
*
* @author https://github.com/inhere
* @homepage https://github.com/inhere/php-console
* @license https://github.com/inhere/php-console/blob/master/LICENSE
*/
namespace Inhere\ConsoleTest;
use Inhere\Console\IO\Input;
use Inhere\Console\IO\Output;
use PHPUnit\Framework\TestCase;
use function vdump;
/**
* Class CommandTest
* @package Inhere\ConsoleTest
*/
class CommandTest extends TestCase
{
public function testCommand_basic_usage(): void
{
$c = new TestCommand(new Input(), new Output());
$this->assertSame('test1', $c::getName());
$this->assertSame('test1', $c->getRealName());
$this->assertStringContainsString('description', $c::getDesc());
$this->assertStringContainsString('description', $c->getRealDesc());
}
public function testCommand_alone_run(): void
{
$c = new TestCommand(new Input(), new Output());
$str = $c->run([]);
$this->assertEquals('Inhere\ConsoleTest\TestCommand::execute', $str);
}
public function testCommand_sub_run(): void
{
$c = new TestCommand(new Input(), Output::new());
$str = $c->run(['sub1']);
$this->assertEquals('at TestCommand::sub1', $str);
}
public function testCommand_sub_help(): void
{
$c = new TestCommand(new Input(), $buf = Output\BufferedOutput::new());
$this->assertNotEmpty($c);
$c->run(['sub1', '-h']);
vdump($buf->toString());
}
}