Exemplo n.º 1
0
 public function testAddFormControl()
 {
     $this->form->expects($this->once())->method('addCheckbox')->with('var', 'Boolean')->will($this->returnValue($this->control));
     $this->control->expects($this->any())->method('setRequiered')->will($this->returnValue($this->control));
     $result = $this->object->addFormControl($this->form, $this->metadata);
     $this->assertSame($this->control, $result);
 }
Exemplo n.º 2
0
 public function testAddFormControl()
 {
     $values = array('foo' => 'bar', 'baz' => 'qux');
     $this->object = $this->getMockBuilder('\\Vodacek\\Form\\Builder\\Mappers\\SelectboxMapper')->setMethods(array('getValues'))->getMockForAbstractClass();
     $this->object->expects($this->any())->method('getValues')->will($this->returnValue($values));
     $this->form->expects($this->any())->method('addSelect')->with('var', 'Select', $values)->will($this->returnValue($this->control));
     $this->object->addFormControl($this->form, $this->metadata);
 }
Exemplo n.º 3
0
 public function testAddFloatWithCustomStep()
 {
     $this->metadata->type = 'float';
     $this->metadata->custom['step'] = '0.002';
     $this->form->expects($this->once())->method('addText')->with('var', 'Int')->will($this->returnValue($this->control));
     $this->controlPrototype->expects($this->any())->method('type')->with('number');
     $this->controlPrototype->expects($this->any())->method('step')->with('0.002');
     $this->object->addFormControl($this->form, $this->metadata);
 }
Exemplo n.º 4
0
 /**
  * @dataProvider dp_testRangeCondition
  */
 public function testRangeCondition($min, $max)
 {
     $this->metadata->conditions['min'] = $min;
     $this->metadata->conditions['max'] = $max;
     $this->form->expects($this->once())->method('addText')->will($this->returnValue($this->control));
     $this->control->expects($this->once())->method('addRule')->with(Builder\EntityForm::RANGE, null, array($min, $max));
     $this->object->addFormControl($this->form, $this->metadata);
 }
Exemplo n.º 5
0
 public function testAddingTextArea()
 {
     $this->metadata->type = 'text';
     $this->form->expects($this->once())->method('addTextArea')->with('var', 'String')->will($this->returnValue($this->control));
     $this->object->addFormControl($this->form, $this->metadata);
 }