/**
  * test case for api call if post values are not there
  *
  * @covers AppBundle\Controller\DemoController::indexAction
  */
 public function testindexActionPostFails()
 {
     $defaultData = array('message' => 'Enter City Name Or Country Name For Weather');
     $this->mockController->expects($this->once())->method('createFormBuilder')->with($this->equalTo($defaultData))->will($this->returnValue($this->mockFormBuilder));
     $this->mockFormBuilder->expects($this->at(0))->method('add')->with($this->equalTo('countryname'), $this->equalTo('text'))->will($this->returnValue($this->mockFormBuilder));
     $this->mockFormBuilder->expects($this->at(1))->method('add')->with($this->equalTo('cityname'), $this->equalTo('text'))->will($this->returnValue($this->mockFormBuilder));
     $this->mockFormBuilder->expects($this->at(2))->method('add')->with($this->equalTo('search'), $this->equalTo('submit'))->will($this->returnValue($this->mockFormBuilder));
     $this->mockFormBuilder->expects($this->once())->method('getForm')->will($this->returnValue($this->mockForm));
     $this->mockRequest->expects($this->once())->method('isMethod')->with($this->equalTo('POST'))->will($this->returnValue(false));
     $this->mockController->expects($this->once())->method('render')->with($this->equalTo('AppBundle:Demo:show.html.twig'), $this->equalTo(array('form' => '')));
     $this->mockController->indexAction($this->mockRequest);
 }
コード例 #2
0
 public function buildForm(Symfony\Component\Form\FormBuilder $builder, array $options)
 {
     $builder->add('value')->add('name', 'hidden', array('data' => $options['attribute_name']));
 }
コード例 #3
0
 public function buildForm(Symfony\Component\Form\FormBuilder $builder, array $options)
 {
     $builder->add('field1', new ExampleDoctrine_Form_UserAttributeType(), array('attribute_name' => 'field1', 'property_path' => '[field1]'));
     $builder->add('field2', new ExampleDoctrine_Form_UserAttributeType(), array('attribute_name' => 'field2', 'property_path' => '[field2]'));
 }
コード例 #4
0
 public function buildForm(Symfony\Component\Form\FormBuilder $builder, array $options)
 {
     $builder->add('comment')->add('publisher');
 }
コード例 #5
0
ファイル: UserType.php プロジェクト: planetenkiller/core
 public function buildForm(Symfony\Component\Form\FormBuilder $builder, array $options)
 {
     $builder->add('username')->add('password')->add('attributes', new ExampleDoctrine_Form_UserAttributesType())->add('metadata', new ExampleDoctrine_Form_UserMetadataType())->add('categories', 'categories', array('module' => 'ExampleDoctrine', 'entity' => 'User', 'entityCategoryClass' => 'ExampleDoctrine_Entity_UserCategory'));
 }