/** * 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); }
public function getAgentAdmin() { if ($this->pid) { $controller = new DefaultController(); $agent_admin = $controller->getDoctrine()->getManager()->getRepository('AppBundle:User')->find($this->pid); return $agent_admin; } }
public function testNieZalogowany() { $this->checker->shouldReceive('isGranted')->with('ROLE_USER')->once()->andReturn(false); $this->assertEmpty($this->controller->indexAction()); }