Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2619759
D25335.1731648490.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Advanced/Developer...
View Handle
View Hovercard
Size
3 KB
Referenced Files
None
Subscribers
None
D25335.1731648490.diff
View Options
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',
@@ -6471,6 +6472,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
@@ -39,13 +39,14 @@
$branch = coalesce($diff->getBranch(), '');
$bookmark = coalesce($diff->getBookmark(), '');
+
if (strlen($branch) && strlen($bookmark)) {
return pht('%s (bookmark) on %s (branch)', $bookmark, $branch);
} else if (strlen($bookmark)) {
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
Details
Attached
Mime Type
text/plain
Expires
Fri, Nov 15, 05:28 (12 h, 39 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
971283
Default Alt Text
D25335.1731648490.diff (3 KB)
Attached To
Mode
D25335: Fix PHP 8.1 DifferentialBranchField getBranchDescription strlen(null) error
Attached
Detach File
Event Timeline
Log In to Comment