1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Lichtenwallner (https://lichtenwallner.at) |
4
|
|
|
* |
5
|
|
|
* @see https://github.com/jolicht/markdown-cms for the canonical source repository |
6
|
|
|
* @license https://github.com/jolicht/markdown-cms/blob/master/LICENSE MIT |
7
|
|
|
* @copyright Copyright (c) Johannes Lichtenwallner |
8
|
|
|
*/ |
9
|
|
|
declare(strict_types = 1); |
10
|
|
|
namespace JolichtTest\MarkdownCms\Command; |
11
|
|
|
|
12
|
|
|
use PHPUnit\Framework\TestCase; |
13
|
|
|
use Jolicht\MarkdownCms\Command\ParseContentCommand; |
14
|
|
|
use Jolicht\MarkdownCms\Parser\ParseContentExecutor; |
15
|
|
|
use Symfony\Component\Console\Input\ArrayInput; |
16
|
|
|
use Symfony\Component\Console\Output\ConsoleOutput; |
17
|
|
|
|
18
|
|
|
class ParseContentCommandTest extends TestCase |
19
|
|
|
{ |
20
|
|
|
private $command, $parseContentExecutor; |
|
|
|
|
21
|
|
|
|
22
|
|
|
protected function setUp() |
23
|
|
|
{ |
24
|
|
|
$this->parseContentExecutor = $this->getMockBuilder(ParseContentExecutor::class) |
25
|
|
|
->disableOriginalConstructor() |
26
|
|
|
->setMethods(['__invoke']) |
27
|
|
|
->getMock(); |
28
|
|
|
$this->command = new ParseContentCommand(); |
29
|
|
|
} |
30
|
|
|
|
31
|
|
|
public function testGetName() |
32
|
|
|
{ |
33
|
|
|
$this->assertSame('markdown-cms:parse', $this->command->getName()); |
34
|
|
|
} |
35
|
|
|
|
36
|
|
|
public function testSetParseContentExecutor() |
37
|
|
|
{ |
38
|
|
|
$this->command->setParseContentExecutor($this->parseContentExecutor); |
39
|
|
|
$this->assertSame($this->parseContentExecutor, $this->command->getParseContentExecutor()); |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
public function testRun() |
43
|
|
|
{ |
44
|
|
|
$this->command->setParseContentExecutor($this->parseContentExecutor); |
45
|
|
|
$this->parseContentExecutor->expects($this->once()) |
46
|
|
|
->method('__invoke'); |
47
|
|
|
|
48
|
|
|
$input = new ArrayInput([]); |
49
|
|
|
$output = new ConsoleOutput(); |
50
|
|
|
$this->command->run($input, $output); |
51
|
|
|
} |
52
|
|
|
} |
Only declaring a single property per statement allows you to later on add doc comments more easily.
It is also recommended by PSR2, so it is a common style that many people expect.