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

ParseContentCommandFactoryTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 5

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 7 1
A testContainerHasService() 0 4 1
A testCreateService() 0 13 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 Reddogs\Test\ServiceManagerAwareTestCase;
13
use Jolicht\MarkdownCms\Command\ParseContentCommandFactory;
14
use Jolicht\MarkdownCms\Command\ParseContentCommand;
15
use Jolicht\MarkdownCms\ModuleConfig;
16
use Jolicht\MarkdownCms\Parser\ParseContentExecutor;
17
18
class ParseContentCommandFactoryTest extends ServiceManagerAwareTestCase
19
{
20
    private $factory;
21
22
    protected function setUp()
23
    {
24
        $this->setConfigProviders([ModuleConfig::class]);
25
        parent::setUp();
26
27
        $this->factory = new ParseContentCommandFactory();
28
    }
29
30
    public function testContainerHasService()
31
    {
32
        $this->assertTrue($this->getContainer()->has(ParseContentCommand::class));
33
    }
34
35
    public function testCreateService()
36
    {
37
        $parseContentExecutor = $this->getMockBuilder(ParseContentExecutor::class)
38
            ->disableOriginalConstructor()
39
            ->getMock();
40
        $container = $this->getContainer();
41
        $container->setAllowOverride(true);
42
        $container->setService(ParseContentExecutor::class, $parseContentExecutor);
43
        $container->setAllowOverride(false);
44
        $command = $this->factory->__invoke($container, ParseContentCommand::class);
45
        $this->assertInstanceOf(ParseContentCommand::class, $command);
46
        $this->assertSame($parseContentExecutor, $command->getParseContentExecutor());
47
    }
48
}