示例#1
0
 public function test_form_method()
 {
     $data = null;
     $options = [];
     $this->formFactory->shouldReceive('create')->once()->withArgs([$this->formType, $data, $options]);
     $this->handler->form($data, $options);
 }
 /**
  * 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);
 }