| @@ 18-31 (lines=14) @@ | ||
| 15 | ||
| 16 | class SidebarControllerTest extends TestCase |
|
| 17 | { |
|
| 18 | public function testCategories(): void |
|
| 19 | { |
|
| 20 | $twig = $this->createMock(Environment::class); |
|
| 21 | $twig |
|
| 22 | ->expects($this->once()) |
|
| 23 | ->method('render') |
|
| 24 | ->with('@HarentiusBlog/Sidebar/categories.html.twig', [ |
|
| 25 | 'categories' => 'categories', |
|
| 26 | ]) |
|
| 27 | ; |
|
| 28 | $sidebarController = $this->createSidebarController($twig); |
|
| 29 | $response = $sidebarController->categories(); |
|
| 30 | $this->assertInstanceOf(Response::class, $response); |
|
| 31 | } |
|
| 32 | ||
| 33 | public function testArchive(): void |
|
| 34 | { |
|
| @@ 33-46 (lines=14) @@ | ||
| 30 | $this->assertInstanceOf(Response::class, $response); |
|
| 31 | } |
|
| 32 | ||
| 33 | public function testArchive(): void |
|
| 34 | { |
|
| 35 | $twig = $this->createMock(Environment::class); |
|
| 36 | $twig |
|
| 37 | ->expects($this->once()) |
|
| 38 | ->method('render') |
|
| 39 | ->with('@HarentiusBlog/Sidebar/archive.html.twig', [ |
|
| 40 | 'archivesList' => 'list', |
|
| 41 | ]) |
|
| 42 | ; |
|
| 43 | $sidebarController = $this->createSidebarController($twig); |
|
| 44 | $response = $sidebarController->archive(); |
|
| 45 | $this->assertInstanceOf(Response::class, $response); |
|
| 46 | } |
|
| 47 | ||
| 48 | public function testTags(): void |
|
| 49 | { |
|
| @@ 48-61 (lines=14) @@ | ||
| 45 | $this->assertInstanceOf(Response::class, $response); |
|
| 46 | } |
|
| 47 | ||
| 48 | public function testTags(): void |
|
| 49 | { |
|
| 50 | $twig = $this->createMock(Environment::class); |
|
| 51 | $twig |
|
| 52 | ->expects($this->once()) |
|
| 53 | ->method('render') |
|
| 54 | ->with('@HarentiusBlog/Sidebar/tags.html.twig', [ |
|
| 55 | 'tags' => 'list', |
|
| 56 | ]) |
|
| 57 | ; |
|
| 58 | $sidebarController = $this->createSidebarController($twig); |
|
| 59 | $response = $sidebarController->tags(); |
|
| 60 | $this->assertInstanceOf(Response::class, $response); |
|
| 61 | } |
|
| 62 | ||
| 63 | private function createSidebarController(Environment $twig): SidebarController |
|
| 64 | { |
|