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
|
|
|
} |