예제 #1
0
 public function setUp()
 {
     parent::setUp();
     stub($this->tracker_config)->isInsecureEmailgatewayEnabled()->returns(true);
     stub($this->tracker_config)->isTokenBasedEmailgatewayEnabled()->returns(false);
     $title_field = aStringField()->build();
     $description_field = aTextField()->build();
     stub($this->tracker)->getTitleField()->returns($title_field);
     stub($this->tracker)->getDescriptionField()->returns($description_field);
     stub($this->tracker)->getFormElementFields()->returns(array($title_field, $description_field));
     $this->changeset = stub('Tracker_Artifact_Changeset')->getId()->returns(666);
 }
 public function itReturnsTheValueIndexedByFieldName()
 {
     $field = aTextField()->build();
     $value = array("field_id" => 873, "value" => array('content' => 'My awesome content', 'format' => 'text'));
     $fields_data = $field->getFieldDataFromRESTValueByField($value);
     $this->assertEqual($fields_data['content'], 'My awesome content');
     $this->assertEqual($fields_data['format'], 'text');
 }
 public function testGetFieldFromTrackerAndSharedField()
 {
     $original_field_dar = TestHelper::arrayToDar($this->createRow(999, 'text'));
     $dao = new MockTracker_FormElement_FieldDao();
     $dao->setReturnValue('searchFieldFromTrackerIdAndSharedFieldId', $original_field_dar, array(66, 123));
     $factory = $this->GivenAFormElementFactory();
     $factory->setReturnValue('getDao', $dao);
     $originalField = aTextField()->withId(999)->build();
     $tracker = aTracker()->withId(66)->build();
     $exportedField = aTextField()->withId(123)->build();
     $this->assertEqual($factory->getFieldFromTrackerAndSharedField($tracker, $exportedField), $originalField);
 }
 public function itStripHTMLWhenFormatIsHTML()
 {
     $field = aTextField()->withTracker(aTracker()->withProject(mock('Project'))->build())->build();
     $text = new Tracker_Artifact_ChangesetValue_Text(111, $field, false, 'Problems with my code: <b>example</b>', Tracker_Artifact_ChangesetValue_Text::HTML_CONTENT);
     $this->assertEqual($text->getContentAsText(), 'Problems with my code: example');
 }
예제 #5
0
 private function givenACriteriaWith_SharedField_SemanticTitle_SemanticStatus_Artifact()
 {
     $release_tracker_id = 133;
     $release_tracker = aTracker()->withId($release_tracker_id)->build();
     $fields = array(aTextField()->withId(220)->build());
     stub($this->form_element_factory)->getSharedFieldsReadableBy()->returns($fields);
     $this->shared_field_criteria = array('220' => array('values' => array('350', '351')));
     $this->semantic_criteria = array('title' => 'Foo', 'status' => '');
     $this->artifact_criteria = array($release_tracker_id => array(3, 6));
     $this->planning_trackers = array($release_tracker);
     $returnValue = array(new Tracker_Artifact(3, 133, null, null, null));
     $returnValue[] = new Tracker_Artifact(6, 133, null, null, null);
     return $this->getCriteria($returnValue);
 }
예제 #6
0
 public function setUp()
 {
     parent::setUp();
     $title_field = aStringField()->build();
     $description_field = aTextField()->build();
     stub($this->tracker)->getTitleField()->returns($title_field);
     stub($this->tracker)->getDescriptionField()->returns($description_field);
     stub($this->tracker)->getFormElementFields()->returns(array($title_field, $description_field));
     $this->changeset = stub('Tracker_Artifact_Changeset')->getId()->returns(666);
     $this->mailgateway = new Tracker_Artifact_MailGateway_InsecureMailGateway($this->parser, $this->incoming_message_factory, $this->citation_stripper, $this->notifier, $this->incoming_mail_dao, $this->artifact_factory, new Tracker_ArtifactByEmailStatus($this->tracker_config), $this->logger);
 }
 /**
  * @see https://tuleap.net/plugins/tracker?aid=6435
  */
 function itIsNotEmptyWhenThereIsContent()
 {
     $artifact = new MockTracker_Artifact();
     $field = aTextField()->build();
     $this->assertFalse($field->isEmpty(array('format' => 'text', 'content' => 'bla'), $artifact));
 }