Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2695484
D25333.1734842994.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
D25333.1734842994.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
@@ -6560,7 +6560,7 @@
'DifferentialDiffRepositoryProjectsHeraldField' => 'DifferentialDiffHeraldField',
'DifferentialDiffSearchConduitAPIMethod' => 'PhabricatorSearchEngineAPIMethod',
'DifferentialDiffSearchEngine' => 'PhabricatorApplicationSearchEngine',
- 'DifferentialDiffTestCase' => 'PhutilTestCase',
+ 'DifferentialDiffTestCase' => 'PhabricatorTestCase',
'DifferentialDiffTransaction' => 'PhabricatorApplicationTransaction',
'DifferentialDiffTransactionQuery' => 'PhabricatorApplicationTransactionQuery',
'DifferentialDiffViewController' => 'DifferentialController',
diff --git a/src/applications/differential/storage/DifferentialDiff.php b/src/applications/differential/storage/DifferentialDiff.php
--- a/src/applications/differential/storage/DifferentialDiff.php
+++ b/src/applications/differential/storage/DifferentialDiff.php
@@ -780,7 +780,7 @@
$refs = array();
$branch = $this->getBranch();
- if (strlen($branch)) {
+ if (phutil_nonempty_string($branch)) {
$refs[] = array(
'type' => 'branch',
'name' => $branch,
@@ -788,7 +788,7 @@
}
$onto = $this->loadTargetBranch();
- if (strlen($onto)) {
+ if (phutil_nonempty_string($onto)) {
$refs[] = array(
'type' => 'onto',
'name' => $onto,
@@ -804,7 +804,7 @@
}
$bookmark = $this->getBookmark();
- if (strlen($bookmark)) {
+ if (phutil_nonempty_string($bookmark)) {
$refs[] = array(
'type' => 'bookmark',
'name' => $bookmark,
diff --git a/src/applications/differential/storage/__tests__/DifferentialDiffTestCase.php b/src/applications/differential/storage/__tests__/DifferentialDiffTestCase.php
--- a/src/applications/differential/storage/__tests__/DifferentialDiffTestCase.php
+++ b/src/applications/differential/storage/__tests__/DifferentialDiffTestCase.php
@@ -1,6 +1,12 @@
<?php
-final class DifferentialDiffTestCase extends PhutilTestCase {
+final class DifferentialDiffTestCase extends PhabricatorTestCase {
+
+ protected function getPhabricatorTestCaseConfiguration() {
+ return array(
+ self::PHABRICATOR_TESTCONFIG_BUILD_STORAGE_FIXTURES => true,
+ );
+ }
public function testDetectCopiedCode() {
$copies = $this->detectCopiesIn('lint_engine.diff');
@@ -73,5 +79,40 @@
$this->assertTrue(true);
}
+ public function testGetFieldValuesForConduit() {
+
+ $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;
+
+ $diff = DifferentialDiff::newFromRawChanges(
+ PhabricatorUser::getOmnipotentUser(),
+ $parser->parseDiff($raw_diff));
+ $this->assertTrue(true);
+
+ try {
+ $field_values = $diff->getFieldValuesForConduit();
+ $this->assertTrue(is_array($field_values));
+ foreach (['revisionPHID', 'authorPHID', 'repositoryPHID', 'refs']
+ as $key) {
+ $this->assertTrue(array_key_exists($key, $field_values));
+ }
+ } catch (Throwable $ex) {
+ $this->assertTrue(false,
+ 'getFieldValuesForConduit threw an exception:'.$ex->getMessage());
+ }
+
+ }
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Dec 22, 04:49 (20 h, 57 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1025366
Default Alt Text
D25333.1734842994.diff (3 KB)
Attached To
Mode
D25333: Fix DifferentialDiff getFieldValuesForConduit PHP 8.1 strlen(null) errors
Attached
Detach File
Event Timeline
Log In to Comment