| Conditions | 1 |
| Paths | 1 |
| Total Lines | 69 |
| Code Lines | 50 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php |
||
| 32 | public function testGenerate() : void |
||
| 33 | { |
||
| 34 | [$issue1, $issue2, $pullRequest1, $pullRequest2, $issueGroup, $milestoneIssues, $issueGroups] = $this->arrangeIssues(); |
||
| 35 | |||
| 36 | $changelogConfig = new ChangelogConfig(self::USER, self::REPOSITORY, self::MILESTONE, []); |
||
| 37 | |||
| 38 | $this->issueRepository->expects(self::once()) |
||
| 39 | ->method('getMilestoneIssues') |
||
| 40 | ->with($changelogConfig) |
||
| 41 | ->willReturn($milestoneIssues); |
||
| 42 | |||
| 43 | $this->issueGrouper->expects(self::once()) |
||
| 44 | ->method('groupIssues') |
||
| 45 | ->with($milestoneIssues) |
||
| 46 | ->willReturn($issueGroups); |
||
| 47 | |||
| 48 | $issueGroup->expects(self::once()) |
||
| 49 | ->method('getName') |
||
| 50 | ->willReturn('Enhancement'); |
||
| 51 | |||
| 52 | $issueGroup->expects(self::once()) |
||
| 53 | ->method('getIssues') |
||
| 54 | ->willReturn([$issue1, $issue2]); |
||
| 55 | |||
| 56 | $issue1->expects(self::once()) |
||
| 57 | ->method('render') |
||
| 58 | ->willReturn('Issue #1'); |
||
| 59 | |||
| 60 | $issue1->expects(self::once()) |
||
| 61 | ->method('getUser') |
||
| 62 | ->willReturn('jwage'); |
||
| 63 | |||
| 64 | $issue2->expects(self::once()) |
||
| 65 | ->method('render') |
||
| 66 | ->willReturn('Issue #2'); |
||
| 67 | |||
| 68 | $issue2->expects(self::once()) |
||
| 69 | ->method('getUser') |
||
| 70 | ->willReturn('jwage'); |
||
| 71 | |||
| 72 | $pullRequest1->expects(self::any()) |
||
| 73 | ->method('isPullRequest') |
||
| 74 | ->willReturn(true); |
||
| 75 | |||
| 76 | $pullRequest1->expects(self::once()) |
||
| 77 | ->method('getUser') |
||
| 78 | ->willReturn('Ocramius'); |
||
| 79 | |||
| 80 | $pullRequest2->expects(self::any()) |
||
| 81 | ->method('isPullRequest') |
||
| 82 | ->willReturn(true); |
||
| 83 | |||
| 84 | $pullRequest2->expects(self::once()) |
||
| 85 | ->method('getUser') |
||
| 86 | ->willReturn('romanb'); |
||
| 87 | |||
| 88 | $output = $this->arrangeConsoleOutput(); |
||
| 89 | |||
| 90 | $output->expects(self::at(0)) |
||
| 91 | ->method('writeln') |
||
| 92 | ->with([ |
||
| 93 | '## 1.0', |
||
| 94 | '', |
||
| 95 | '- Total issues resolved: **2**', |
||
| 96 | '- Total pull requests resolved: **2**', |
||
| 97 | '- Total contributors: **3**', |
||
| 98 | ]); |
||
| 99 | |||
| 100 | $this->changelogGenerator->generate($changelogConfig, $output); |
||
| 101 | } |
||
| 225 |