|
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 PHPUnit\Framework\TestCase; |
|
13
|
|
|
use Zend\Expressive\Template\TemplateRendererInterface; |
|
14
|
|
|
use Jolicht\MarkdownCms\Action\AbstractAction; |
|
15
|
|
|
use Jolicht\MarkdownCms\ContentType\EntryParser; |
|
16
|
|
|
|
|
17
|
|
|
class AbstractActionTest extends TestCase |
|
18
|
|
|
{ |
|
19
|
|
|
private $action, $templateRenderer, $entryParser, $markdownCmsConfig; |
|
|
|
|
|
|
20
|
|
|
|
|
21
|
|
|
protected function setUp() |
|
22
|
|
|
{ |
|
23
|
|
|
$this->templateRenderer = $this->createMock(TemplateRendererInterface::class); |
|
24
|
|
|
$this->entryParser = $this->createMock(EntryParser::class); |
|
25
|
|
|
$this->markdownCmsConfig = [ |
|
26
|
|
|
'options' => [ |
|
27
|
|
|
|
|
28
|
|
|
] |
|
29
|
|
|
]; |
|
30
|
|
|
$this->action = $this->getMockBuilder(AbstractAction::class) |
|
31
|
|
|
->setConstructorArgs([ |
|
32
|
|
|
$this->templateRenderer, $this->entryParser, $this->markdownCmsConfig |
|
33
|
|
|
])->getMockForAbstractClass(); |
|
34
|
|
|
} |
|
35
|
|
|
|
|
36
|
|
|
public function testGetTemplateRenderer() |
|
37
|
|
|
{ |
|
38
|
|
|
$this->assertSame($this->templateRenderer, $this->action->getTemplateRenderer()); |
|
39
|
|
|
} |
|
40
|
|
|
|
|
41
|
|
|
public function testGetEntryParser() |
|
42
|
|
|
{ |
|
43
|
|
|
$this->assertSame($this->entryParser, $this->action->getEntryParser()); |
|
44
|
|
|
} |
|
45
|
|
|
|
|
46
|
|
|
public function testGetMarkdownCmsConfig() |
|
47
|
|
|
{ |
|
48
|
|
|
$this->assertSame($this->markdownCmsConfig, $this->action->getMarkdownCmsConfig()); |
|
49
|
|
|
} |
|
50
|
|
|
} |
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.