Differential D17066 Diff 41082 src/applications/differential/field/DifferentialTestPlanCommitMessageField.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/differential/field/DifferentialTestPlanCommitMessageField.php
| <?php | <?php | ||||
| final class DifferentialTestPlanCommitMessageField | final class DifferentialTestPlanCommitMessageField | ||||
| extends DifferentialCommitMessageField { | extends DifferentialCommitMessageField { | ||||
| const FIELDKEY = 'testPlan'; | const FIELDKEY = 'testPlan'; | ||||
| public function getFieldName() { | public function getFieldName() { | ||||
| return pht('Test Plan'); | return pht('Test Plan'); | ||||
| } | } | ||||
| public function getFieldOrder() { | |||||
| return 3000; | |||||
| } | |||||
| public function getFieldAliases() { | public function getFieldAliases() { | ||||
| return array( | return array( | ||||
| 'Testplan', | 'Testplan', | ||||
| 'Tested', | 'Tested', | ||||
| 'Tests', | 'Tests', | ||||
| ); | ); | ||||
| } | } | ||||
| public function isFieldEnabled() { | public function isFieldEnabled() { | ||||
| return $this->isCustomFieldEnabled('differential:test-plan'); | return $this->isCustomFieldEnabled('differential:test-plan'); | ||||
| } | } | ||||
| public function validateFieldValue($value) { | public function validateFieldValue($value) { | ||||
| $is_required = PhabricatorEnv::getEnvConfig( | $is_required = PhabricatorEnv::getEnvConfig( | ||||
| 'differential.require-test-plan-field'); | 'differential.require-test-plan-field'); | ||||
| if ($is_required && !strlen($value)) { | if ($is_required && !strlen($value)) { | ||||
| $this->raiseValidationException( | $this->raiseValidationException( | ||||
| pht( | pht( | ||||
| 'You must provide a test plan. Describe the actions you performed '. | 'You must provide a test plan. Describe the actions you performed '. | ||||
| 'to verify the behavior of this change.')); | 'to verify the behavior of this change.')); | ||||
| } | } | ||||
| } | } | ||||
| public function readFieldValueFromObject(DifferentialRevision $revision) { | |||||
| return $revision->getTestPlan(); | |||||
| } | |||||
| } | } | ||||