container = $this->prophesize(ContainerInterface::class); $this->router = $this->prophesize(RouterInterface::class); } public function testReturnsJsonResponseWhenNoTemplateRendererProvided() { $homePage = new HomePageHandler( get_class($this->container->reveal()), $this->router->reveal(), null ); $response = $homePage->handle( $this->prophesize(ServerRequestInterface::class)->reveal() ); $this->assertInstanceOf(JsonResponse::class, $response); } public function testReturnsHtmlResponseWhenTemplateRendererProvided() { $renderer = $this->prophesize(TemplateRendererInterface::class); $renderer ->render('app::home-page', Argument::type('array')) ->willReturn(''); $homePage = new HomePageHandler( get_class($this->container->reveal()), $this->router->reveal(), $renderer->reveal() ); $response = $homePage->handle( $this->prophesize(ServerRequestInterface::class)->reveal() ); $this->assertInstanceOf(HtmlResponse::class, $response); } }