1 | <?php |
||
21 | class BlogOverviewActionTest extends TestCase |
||
22 | { |
||
23 | private $action, $templateRenderer, $entryParser, $markdownCmsConfig; |
||
24 | |||
25 | public function setUp() |
||
26 | { |
||
27 | $this->templateRenderer = $this->prophesize(TemplateRendererInterface::class); |
||
28 | $this->entryParser = $this->prophesize(EntryParser::class); |
||
29 | $this->markdownCmsConfig = [ |
||
30 | 'content' => [ |
||
31 | 'content_types' => [ |
||
32 | 'blogEntry' => [ |
||
33 | 'all' => [ |
||
34 | 'testDate' => 'testId' |
||
35 | ] |
||
36 | ] |
||
37 | ] |
||
38 | ] |
||
39 | ]; |
||
40 | |||
41 | $this->action = new BlogOverviewAction( |
||
42 | $this->templateRenderer->reveal(), |
||
43 | $this->entryParser->reveal(), |
||
44 | $this->markdownCmsConfig |
||
45 | ); |
||
46 | } |
||
47 | |||
48 | |||
49 | public function testInvoke() |
||
50 | { |
||
51 | $entry = $this->prophesize(ContentTypeInterface::class); |
||
52 | |||
53 | $this->entryParser |
||
54 | ->__invoke('testId') |
||
55 | ->willReturn($entry->reveal()); |
||
56 | |||
57 | $this->templateRenderer |
||
58 | ->render('app::blog-overwiew.twig', ['entries' => [$entry->reveal()]]) |
||
59 | ->willReturn(''); |
||
60 | |||
61 | $response = ($this->action)( |
||
62 | $this->prophesize(ServerRequestInterface::class)->reveal(), |
||
63 | $this->prophesize(ResponseInterface::class)->reveal() |
||
64 | ); |
||
65 | $this->assertInstanceOf(HtmlResponse::class, $response); |
||
66 | } |
||
67 | } |