Page MenuHomePhorge

D25333.1726912819.diff
No OneTemporary

D25333.1726912819.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
@@ -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 ($base !== null && strlen($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,35 @@
$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);
+
+ $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));
+ }
+
+ }
}

File Metadata

Mime Type
text/plain
Expires
Sat, Sep 21, 10:00 (18 h, 38 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
893790
Default Alt Text
D25333.1726912819.diff (3 KB)

Event Timeline