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 @@ 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 = <<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()); + } + + } }