|
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\Action; |
|
11
|
|
|
|
|
12
|
|
|
use Reddogs\Test\ServiceManagerAwareTestCase; |
|
13
|
|
|
use Jolicht\MarkdownCms\Action\SingleBlogEntryActionFactory; |
|
14
|
|
|
use Jolicht\MarkdownCms\Action\SingleBlogEntryAction; |
|
15
|
|
|
use Jolicht\MarkdownCms\ModuleConfig; |
|
16
|
|
|
use Zend\Expressive\Template\TemplateRendererInterface; |
|
17
|
|
|
use Jolicht\MarkdownCms\ContentType\ContentCreator; |
|
18
|
|
|
use Jolicht\MarkdownCms\Markdown\MarkdownDocumentParser; |
|
19
|
|
|
|
|
20
|
|
|
class SingleBlogEntryActionFactoryTest extends ServiceManagerAwareTestCase |
|
21
|
|
|
{ |
|
22
|
|
|
private $factory; |
|
23
|
|
|
|
|
24
|
|
|
protected function setUp() |
|
25
|
|
|
{ |
|
26
|
|
|
$this->setConfigProviders([ModuleConfig::class]); |
|
27
|
|
|
parent::setUp(); |
|
28
|
|
|
$this->factory = new SingleBlogEntryActionFactory(); |
|
29
|
|
|
} |
|
30
|
|
|
|
|
31
|
|
|
public function testContainerHasService() |
|
32
|
|
|
{ |
|
33
|
|
|
$this->assertTrue($this->getContainer()->has(SingleBlogEntryAction::class)); |
|
34
|
|
|
} |
|
35
|
|
|
|
|
36
|
|
|
public function testCreateService() |
|
37
|
|
|
{ |
|
38
|
|
|
$container = $this->getContainer(); |
|
39
|
|
|
|
|
40
|
|
|
$renderer = $this->createMock(TemplateRendererInterface::class); |
|
41
|
|
|
$contentCreator = $this->createMock(ContentCreator::class); |
|
42
|
|
|
$parser = $this->createMock(MarkdownDocumentParser::class); |
|
43
|
|
|
$config = [ |
|
44
|
|
|
'markdown_cms' => ['testconfig'] |
|
45
|
|
|
]; |
|
46
|
|
|
|
|
47
|
|
|
$container->setAllowOverride(true); |
|
48
|
|
|
$container->setService(TemplateRendererInterface::class, $renderer); |
|
49
|
|
|
$container->setService(ContentCreator::class, $contentCreator); |
|
50
|
|
|
$container->setService(MarkdownDocumentParser::class, $parser); |
|
51
|
|
|
$container->setService('config', $config); |
|
52
|
|
|
$container->setAllowOverride(false); |
|
53
|
|
|
|
|
54
|
|
|
$action = $this->factory->__invoke($container, SingleBlogEntryAction::class); |
|
55
|
|
|
$this->assertInstanceOf(SingleBlogEntryAction::class, $action); |
|
56
|
|
|
$this->assertSame($renderer, $action->getTemplateRenderer()); |
|
57
|
|
|
$this->assertSame($contentCreator, $action->getContentCreator()); |
|
58
|
|
|
$this->assertSame($parser, $action->getMarkdownDocumentParser()); |
|
59
|
|
|
$this->assertSame(['testconfig'], $action->getMarkdownCmsConfig()); |
|
60
|
|
|
} |
|
61
|
|
|
} |