| @@ 18-32 (lines=15) @@ | ||
| 15 | ||
| 16 | class ShowControllerTest extends TestCase |
|
| 17 | { |
|
| 18 | public function testInvokeWithArticle(): void |
|
| 19 | { |
|
| 20 | $article = new Article(); |
|
| 21 | $twig = $this->createMock(Environment::class); |
|
| 22 | $twig |
|
| 23 | ->expects($this->once()) |
|
| 24 | ->method('render') |
|
| 25 | ->with('@HarentiusBlog/Show/article.html.twig', [ |
|
| 26 | 'entity' => $article, |
|
| 27 | ]) |
|
| 28 | ; |
|
| 29 | $showController = $this->createShowController($twig); |
|
| 30 | $response = $showController($article); |
|
| 31 | $this->assertInstanceOf(Response::class, $response); |
|
| 32 | } |
|
| 33 | ||
| 34 | public function testInvokeWithPage(): void |
|
| 35 | { |
|
| @@ 34-48 (lines=15) @@ | ||
| 31 | $this->assertInstanceOf(Response::class, $response); |
|
| 32 | } |
|
| 33 | ||
| 34 | public function testInvokeWithPage(): void |
|
| 35 | { |
|
| 36 | $page = new Page(); |
|
| 37 | $twig = $this->createMock(Environment::class); |
|
| 38 | $twig |
|
| 39 | ->expects($this->once()) |
|
| 40 | ->method('render') |
|
| 41 | ->with('@HarentiusBlog/Show/page.html.twig', [ |
|
| 42 | 'entity' => $page, |
|
| 43 | ]) |
|
| 44 | ; |
|
| 45 | $showController = $this->createShowController($twig); |
|
| 46 | $response = $showController($page); |
|
| 47 | $this->assertInstanceOf(Response::class, $response); |
|
| 48 | } |
|
| 49 | ||
| 50 | private function createShowController(Environment $twig): ShowController |
|
| 51 | { |
|