Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2695789
D25333.1734855426.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.1734855426.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,
@@ -796,7 +796,7 @@
}
$base = $this->getSourceControlBaseRevision();
- if (strlen($base)) {
+ if (phutil_nonempty_string($base)) {
$refs[] = array(
'type' => 'base',
'identifier' => $base,
@@ -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, 08:17 (17 h, 6 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1025588
Default Alt Text
D25333.1734855426.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