| Conditions | 1 |
| Paths | 1 |
| Total Lines | 59 |
| 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 |
||
| 134 | public function testDbMultiLevelPipeFlow() |
||
| 135 | { |
||
| 136 | $provider = new ArrayProvider('heroes', [ |
||
| 137 | [ |
||
| 138 | 'name' => 'Spiderman', |
||
| 139 | 'code' => 'spider-man', |
||
| 140 | 'team' => 'Avengers', |
||
| 141 | ], |
||
| 142 | [ |
||
| 143 | 'name' => 'Hulk', |
||
| 144 | 'code' => 'hulk', |
||
| 145 | 'team' => 'Avengers', |
||
| 146 | ], |
||
| 147 | [ |
||
| 148 | 'name' => 'Super Man', |
||
| 149 | 'code' => 'superman', |
||
| 150 | 'team' => 'Justice League', |
||
| 151 | ], |
||
| 152 | ]); |
||
| 153 | (new Plumber($provider, $this->pipeline, $this->emitter))->pour(); |
||
| 154 | |||
| 155 | $actualHeroes = $this->getConnection()->createQueryTable('heroes', 'SELECT * FROM `heroes`'); |
||
| 156 | $actualTeams = $this->getConnection()->createQueryTable('teams', 'SELECT * FROM `teams`'); |
||
| 157 | $expected = $this->createArrayDataSet([ |
||
| 158 | 'heroes' => [ |
||
| 159 | [ |
||
| 160 | 'id' => 1, |
||
| 161 | 'name' => 'Spiderman', |
||
| 162 | 'code' => 'spider-man', |
||
| 163 | 'team_id' => 1, |
||
| 164 | ], |
||
| 165 | [ |
||
| 166 | 'id' => 2, |
||
| 167 | 'name' => 'Hulk', |
||
| 168 | 'code' => 'hulk', |
||
| 169 | 'team_id' => 1, |
||
| 170 | ], |
||
| 171 | [ |
||
| 172 | 'id' => 3, |
||
| 173 | 'name' => 'Super Man', |
||
| 174 | 'code' => 'superman', |
||
| 175 | 'team_id' => 2, |
||
| 176 | ], |
||
| 177 | ], |
||
| 178 | 'teams' => [ |
||
| 179 | [ |
||
| 180 | 'id' => 1, |
||
| 181 | 'name' => 'Avengers', |
||
| 182 | ], |
||
| 183 | [ |
||
| 184 | 'id' => 2, |
||
| 185 | 'name' => 'Justice League', |
||
| 186 | ], |
||
| 187 | ], |
||
| 188 | ]); |
||
| 189 | |||
| 190 | $this->assertTablesEqual($expected->getTable('teams'), $actualTeams); |
||
| 191 | $this->assertTablesEqual($expected->getTable('heroes'), $actualHeroes); |
||
| 192 | } |
||
| 193 | } |
||
| 194 |