Example #1
0
 public function setUp()
 {
     parent::setUp();
     $this->from = aFieldListStaticValue()->withId(123)->build();
     $this->to = aFieldListStaticValue()->withId(456)->build();
     PermissionsManager::setInstance(mock('PermissionsManager'));
 }
 public function itHasAnHiddenFieldForEachCheckbox()
 {
     $value = aFieldListStaticValue()->withId(55)->withLabel('bla')->build();
     $field = new Tracker_FormElement_Field_CheckboxHTMLTest();
     $field->setBind(mock('Tracker_FormElement_Field_List_Bind_Static'));
     $html = $field->fetchFieldValue($value, 'lename', false);
     $this->assertPattern('/<input type="hidden" lename/', $html);
 }
 function testGetFieldDataMultiple()
 {
     $bv1 = aFieldListStaticValue()->withLabel('Admin')->build();
     $bv2 = aFieldListStaticValue()->withLabel('Tracker')->build();
     $bv3 = aFieldListStaticValue()->withLabel('User Interface')->build();
     $bv4 = aFieldListStaticValue()->withLabel('Docman')->build();
     $values = array(13564 => $bv1, 13987 => $bv2, 125 => $bv3, 666 => $bv4);
     $res = array('13564', '125', '666');
     $f = aBindStatic()->withValues($values)->build();
     $this->assertEqual($res, $f->getFieldData('Admin,User Interface,Docman', true));
 }
Example #4
0
 private function setUpFields(Tracker_FormElementFactory $formelement_factory)
 {
     $list_field = aSelectboxField()->withId(323)->isUsed()->build();
     $date_field = aMockDateWithoutTimeField()->withId(322)->isUsed()->build();
     $integer_field = anIntegerField()->withId(321)->isUsed()->build();
     $static_bind = aBindStatic()->withField($list_field)->withValues(array(aFieldListStaticValue()->withId($this->static_value_open_bind_id)->withLabel('Open')->build()))->build();
     $list_field->setBind($static_bind);
     stub($formelement_factory)->getFormElementByName($this->tracker_id, $this->list_field_name)->returns($list_field);
     stub($formelement_factory)->getFormElementByName($this->tracker_id, $this->date_field_name)->returns($date_field);
     stub($formelement_factory)->getFormElementByName($this->tracker_id, $this->int_field_name)->returns($integer_field);
     $field_title = mock('Tracker_FormElement_Field_Text');
     stub($field_title)->getFieldDataFromSoapValue()->returns('titre');
     stub($formelement_factory)->getUsedFieldByName($this->tracker_id, 'title')->returns($field_title);
 }
 public function setUp()
 {
     parent::setUp();
     $this->user = mock('PFUser');
     $id = $tracker_id = $parent_id = $description = $use_it = $scope = $required = $notifications = $rank = '';
     $name = 'foo';
     $label = 'Foo Bar';
     $this->field = partial_mock('Tracker_FormElement_Field_Selectbox', array('userCanRead'), array($id, $tracker_id, $parent_id, $name, $label, $description, $use_it, $scope, $required, $notifications, $rank));
     $this->list_values = array(aFieldListStaticValue()->withId(100)->withLabel('None')->build(), aFieldListStaticValue()->withId(101)->withLabel('Bla')->build());
     $this->changeset_value = new Tracker_Artifact_ChangesetValue_List('whatever', $this->field, true, $this->list_values);
     $this->last_changeset = mock('Tracker_Artifact_Changeset');
     stub($this->last_changeset)->getValue($this->field)->returns($this->changeset_value);
 }
 public function setUp()
 {
     parent::setUp();
     stub($this->dao)->searchMappingFields($this->tracker_id)->returns(TestHelper::arrayToDar(array('cardwall_tracker_id' => 666, 'tracker_id' => 69, 'field_id' => 321)));
     $existing_mappings = array(42 => new Cardwall_OnTop_Config_TrackerMappingStatus($this->task_tracker, array(), array(), $this->status_field), 69 => new Cardwall_OnTop_Config_TrackerMappingFreestyle($this->story_tracker, array(), array(9001 => new Cardwall_OnTop_Config_ValueMapping(aFieldListStaticValue()->withId(9001)->build(), 11), 9002 => new Cardwall_OnTop_Config_ValueMapping(aFieldListStaticValue()->withId(9002)->build(), 11), 9007 => new Cardwall_OnTop_Config_ValueMapping(aFieldListStaticValue()->withId(9002)->build(), 12)), $this->stage_field));
     $this->command = new Cardwall_OnTop_Config_Command_UpdateMappingFields($this->tracker, $this->dao, $this->value_dao, $this->tracker_factory, $this->element_factory, $existing_mappings);
 }