Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/src/applications/differential/field/DifferentialTestPlanCommitMessageField.php
12256 views
1
<?php
2
3
final class DifferentialTestPlanCommitMessageField
4
extends DifferentialCommitMessageField {
5
6
const FIELDKEY = 'testPlan';
7
8
public function getFieldName() {
9
return pht('Test Plan');
10
}
11
12
public function getFieldOrder() {
13
return 3000;
14
}
15
16
public function getFieldAliases() {
17
return array(
18
'Testplan',
19
'Tested',
20
'Tests',
21
);
22
}
23
24
public function isFieldEnabled() {
25
return $this->isCustomFieldEnabled('differential:test-plan');
26
}
27
28
public function validateFieldValue($value) {
29
$is_required = PhabricatorEnv::getEnvConfig(
30
'differential.require-test-plan-field');
31
32
if ($is_required && !strlen($value)) {
33
$this->raiseValidationException(
34
pht(
35
'You must provide a test plan. Describe the actions you performed '.
36
'to verify the behavior of this change.'));
37
}
38
}
39
40
public function readFieldValueFromObject(DifferentialRevision $revision) {
41
return $revision->getTestPlan();
42
}
43
44
public function getFieldTransactions($value) {
45
return array(
46
array(
47
'type' => DifferentialRevisionTestPlanTransaction::EDITKEY,
48
'value' => $value,
49
),
50
);
51
}
52
53
}
54
55