AppBundle\Controller\DefaultController::indexAction PHP Method

indexAction() public method

public indexAction ( )
    public function indexAction()
    {
        // replace this example code with whatever you need
        return $this->render('default/index.html.twig', array('base_dir' => str_replace('/', DIRECTORY_SEPARATOR, realpath($this->getParameter('kernel.root_dir') . '/../') . '/')));
    }

Usage Example

 /**
  * unit test
  */
 public function testIndexAction()
 {
     $request = new Request();
     $formMock = \Mockery::mock(Form::class);
     $formMock->shouldReceive('handleRequest')->with($request)->andReturnSelf();
     $formMock->shouldReceive('isValid')->andReturn(true);
     $formMock->shouldReceive('getData')->andReturn(['content' => ' ']);
     $formViewMock = \Mockery::mock(FormView::class);
     $formMock->shouldReceive('createView')->andReturn($formViewMock);
     $this->formFactoryMock->shouldReceive('createBuilder->add->getForm')->andReturn($formMock);
     $this->twigMock->shouldReceive('render')->withAnyArgs();
     $controller = new DefaultController($this->formFactoryMock, $this->twigMock, __DIR__ . '/../../../app/');
     $x = $controller->indexAction($request);
 }
All Usage Examples Of AppBundle\Controller\DefaultController::indexAction
DefaultController