Differential D9287 Diff 22326 src/applications/differential/parser/__tests__/DifferentialHunkParserTestCase.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/differential/parser/__tests__/DifferentialHunkParserTestCase.php
<?php | <?php | ||||
final class DifferentialHunkParserTestCase extends PhabricatorTestCase { | final class DifferentialHunkParserTestCase extends PhabricatorTestCase { | ||||
private function createComment() { | private function createComment() { | ||||
$comment = new DifferentialInlineComment(); | $comment = new DifferentialInlineComment(); | ||||
return $comment; | return $comment; | ||||
} | } | ||||
private function createHunk( | |||||
$old_offset, | |||||
$old_len, | |||||
$new_offset, | |||||
$new_len, | |||||
$changes) { | |||||
$hunk = id(new DifferentialHunk()) | |||||
->setOldOffset($old_offset) | |||||
->setOldLen($old_len) | |||||
->setNewOffset($new_offset) | |||||
->setNewLen($new_len) | |||||
->setChanges($changes); | |||||
private function createHunk($oldOffset, $oldLen, $newOffset, $newLen, $changes) { | |||||
$hunk = new DifferentialHunk(); | |||||
$hunk->setOldOffset($oldOffset); | |||||
$hunk->setOldLen($oldLen); | |||||
$hunk->setNewOffset($newOffset); | |||||
$hunk->setNewLen($newLen); | |||||
$hunk->setChanges($changes); | |||||
return $hunk; | return $hunk; | ||||
} | } | ||||
// Returns a change that consists of a single hunk, starting at line 1. | // Returns a change that consists of a single hunk, starting at line 1. | ||||
private function createSingleChange($old_lines, $new_lines, $changes) { | private function createSingleChange($old_lines, $new_lines, $changes) { | ||||
return array( | return array( | ||||
0 => $this->createHunk(1, $old_lines, 1, $new_lines, $changes), | 0 => $this->createHunk(1, $old_lines, 1, $new_lines, $changes), | ||||
); | ); | ||||
} | } | ||||
private function createHunksFromFile($name) { | private function createHunksFromFile($name) { | ||||
▲ Show 20 Lines • Show All 255 Lines • Show Last 20 Lines |