public function testDifferentialCommitMessageParserNormalization() { $map = array('Test Plan' => 'test plan', 'REVIEWERS' => 'reviewers', 'sUmmArY' => 'summary'); foreach ($map as $input => $expect) { $this->assertEqual($expect, DifferentialCommitMessageParser::normalizeFieldLabel($input), pht('Field normalization of label "%s".', $input)); } }
private function buildLabelMap(PhabricatorCustomFieldList $field_list) { $label_map = array(); foreach ($field_list->getFields() as $key => $field) { $labels = $field->getCommitMessageLabels(); $key = $field->getFieldKeyForConduit(); foreach ($labels as $label) { $normal_label = DifferentialCommitMessageParser::normalizeFieldLabel($label); if (!empty($label_map[$normal_label])) { throw new Exception(pht('Field label "%s" is parsed by two custom fields: "%s" and ' . '"%s". Each label must be parsed by only one field.', $label, $key, $label_map[$normal_label])); } $label_map[$normal_label] = $key; } } return $label_map; }