Conditions | 1 |
Paths | 1 |
Total Lines | 62 |
Code Lines | 35 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 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 |
||
68 | 'NOT' => ['status' => 'resolved'], |
||
69 | ], |
||
70 | ] |
||
71 | ); |
||
72 | $this->assertEquals(3, $reports->count()); |
||
73 | |||
74 | // Run the shell command |
||
75 | $this->exec('sync_github_issue_states'); |
||
76 | $this->assertExitCode(Command::CODE_SUCCESS); |
||
77 | |||
78 | // Fetch all linked reports |
||
79 | $reports = $Reports->find( |
||
80 | 'all', |
||
81 | [ |
||
82 | 'conditions' => [ |
||
83 | 'sourceforge_bug_id IS NOT NULL', |
||
84 | 'NOT' => ['status' => 'resolved'], |
||
85 | ], |
||
86 | ] |
||
87 | ); |
||
88 | $this->assertEquals(2, $reports->count()); |
||
89 | |||
90 | // Fetch all closed reports |
||
91 | $reports = $Reports->find( |
||
92 | 'all', |
||
93 | [ |
||
94 | 'conditions' => [ |
||
95 | 'sourceforge_bug_id IS NOT NULL', |
||
96 | 'status' => 'resolved', |
||
97 | ], |
||
98 | ] |
||
99 | ); |
||
100 | $this->assertEquals(1, $reports->count()); |
||
101 | $report5 = $Reports->get(4); |
||
102 | $this->assertEquals('resolved', $report5->status); |
||
103 | } |
||
104 | } |
||
105 |