IndexController example


class IndexControllerTest extends TestCase
{
    public function testIndexRedirectsToInstall(): void
    {
        $router = $this->createMock(Router::class);
        $router
            ->method('generate')
            ->willReturnArgument(0);

        $controller = new IndexController();
        $container = new Container();
        $container->set('router', $router);

        $twig = $this->createMock(Environment::class);
        $twig->method('render')->willReturnArgument(0);

        $container->set('twig', $twig);

        $controller->setContainer($container);

        $response = $controller->index();
        
Home | Imprint | This part of the site doesn't use cookies.