-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathDemoCommandTest.php
More file actions
41 lines (34 loc) · 1017 Bytes
/
DemoCommandTest.php
File metadata and controls
41 lines (34 loc) · 1017 Bytes
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
<?php
declare(strict_types=1);
namespace DotTest\Cli\Command;
use Dot\Cli\Command\DemoCommand;
use DotTest\Cli\CommonTrait;
use PHPUnit\Framework\TestCase;
use ReflectionException;
use ReflectionMethod;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\Console\Output\BufferedOutput;
class DemoCommandTest extends TestCase
{
use CommonTrait;
public function testWillCreateCommand(): void
{
$command = new DemoCommand();
$this->assertContainsOnlyInstancesOf(DemoCommand::class, [$command]);
}
/**
* @throws ReflectionException
*/
public function testCommandWillExecute(): void
{
$command = new DemoCommand();
$reflection = new ReflectionMethod(DemoCommand::class, 'execute');
$result = $reflection->invoke(
$command,
new ArgvInput(),
new BufferedOutput()
);
$this->assertSame($result, Command::SUCCESS);
}
}