setService(RouterInterface::class, $this->createMock(RouterInterface::class)); $factory = new HomePageHandlerFactory(); $homePage = $factory($container); self::assertInstanceOf(HomePageHandler::class, $homePage); } public function testFactoryWithTemplate(): void { $container = new InMemoryContainer(); $container->setService(RouterInterface::class, $this->createMock(RouterInterface::class)); $container->setService(TemplateRendererInterface::class, $this->createMock(TemplateRendererInterface::class)); $factory = new HomePageHandlerFactory(); $homePage = $factory($container); self::assertInstanceOf(HomePageHandler::class, $homePage); } }