Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2690122
D25335.1734744414.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.1734744414.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',
@@ -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
Details
Attached
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)
Attached To
Mode
D25335: Fix PHP 8.1 DifferentialBranchField getBranchDescription strlen(null) error
Attached
Detach File
Event Timeline
Log In to Comment