Test Failed
Push — master ( d3e9ef...1b9271 )
by Johannes
04:34
created

ParseContentCommandTest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 5

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 5
dl 0
loc 35
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 8 1
A testGetName() 0 4 1
A testSetParseContentExecutor() 0 5 1
A testRun() 0 10 1
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;
0 ignored issues
show
Coding Style introduced by
It is generally advisable to only define one property per statement.

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.

Loading history...
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
}