Page MenuHomePhorge

D25335.1734744414.diff
No OneTemporary

D25335.1734744414.diff

diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -466,6 +466,7 @@
'DifferentialBlockHeraldAction' => 'applications/differential/herald/DifferentialBlockHeraldAction.php',
'DifferentialBlockingReviewerDatasource' => 'applications/differential/typeahead/DifferentialBlockingReviewerDatasource.php',
'DifferentialBranchField' => 'applications/differential/customfield/DifferentialBranchField.php',
+ 'DifferentialBranchFieldTestCase' => 'applications/differential/customfield/__tests__/DifferentialBranchFieldTestCase.php',
'DifferentialBuildableEngine' => 'applications/differential/harbormaster/DifferentialBuildableEngine.php',
'DifferentialChangeDetailMailView' => 'applications/differential/mail/DifferentialChangeDetailMailView.php',
'DifferentialChangeHeraldFieldGroup' => 'applications/differential/herald/DifferentialChangeHeraldFieldGroup.php',
@@ -6472,6 +6473,7 @@
'DifferentialBlockHeraldAction' => 'HeraldAction',
'DifferentialBlockingReviewerDatasource' => 'PhabricatorTypeaheadCompositeDatasource',
'DifferentialBranchField' => 'DifferentialCustomField',
+ 'DifferentialBranchFieldTestCase' => 'PhabricatorTestCase',
'DifferentialBuildableEngine' => 'HarbormasterBuildableEngine',
'DifferentialChangeDetailMailView' => 'DifferentialMailView',
'DifferentialChangeHeraldFieldGroup' => 'HeraldFieldGroup',
diff --git a/src/applications/differential/customfield/DifferentialBranchField.php b/src/applications/differential/customfield/DifferentialBranchField.php
--- a/src/applications/differential/customfield/DifferentialBranchField.php
+++ b/src/applications/differential/customfield/DifferentialBranchField.php
@@ -45,7 +45,7 @@
return pht('%s (bookmark)', $bookmark);
} else if (strlen($branch)) {
$onto = $diff->loadTargetBranch();
- if (strlen($onto) && ($onto !== $branch)) {
+ if (phutil_nonempty_string($onto) && ($onto !== $branch)) {
return pht(
'%s (branched from %s)',
$branch,
diff --git a/src/applications/differential/customfield/__tests__/DifferentialBranchFieldTestCase.php b/src/applications/differential/customfield/__tests__/DifferentialBranchFieldTestCase.php
new file mode 100644
--- /dev/null
+++ b/src/applications/differential/customfield/__tests__/DifferentialBranchFieldTestCase.php
@@ -0,0 +1,39 @@
+<?php
+
+final class DifferentialBranchFieldTestCase extends PhabricatorTestCase {
+
+ protected function getPhabricatorTestCaseConfiguration() {
+ return array(
+ self::PHABRICATOR_TESTCONFIG_BUILD_STORAGE_FIXTURES => true,
+ );
+ }
+
+ private function getTestDiff() {
+ $parser = new ArcanistDiffParser();
+ $raw_diff = <<<EODIFF
+diff --git a/src b/src
+index 123457..bb216b1 100644
+--- a/src
++++ b/src
+@@ -1,5 +1,5 @@
+ Line a
+-Line b
++Line 2
+ Line c
+ Line d
+ Line e
+EODIFF;
+
+ return DifferentialDiff::newFromRawChanges(
+ PhabricatorUser::getOmnipotentUser(),
+ $parser->parseDiff($raw_diff));
+ }
+
+ public function testRenderDiffPropertyViewValue() {
+ $test_object = new DifferentialBranchField();
+ $diff = $this->getTestDiff();
+ $diff->setBranch('test');
+ $this->assertEqual('test',
+ $test_object->renderDiffPropertyViewValue($diff));
+ }
+}

File Metadata

Mime Type
text/plain
Expires
Sat, Dec 21, 01:26 (18 h, 27 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1021578
Default Alt Text
D25335.1734744414.diff (3 KB)

Event Timeline