| Conditions | 1 |
| Paths | 1 |
| Total Lines | 112 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 1 | 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 |
||
| 158 | public function testExtendedVersionDumper() |
||
| 159 | { |
||
| 160 | $dumper = new KeywordsDumper($this->keywords); |
||
| 161 | |||
| 162 | $dumped = $dumper->dump('ru', false); |
||
| 163 | $etalon = array( |
||
| 164 | <<<GHERKIN |
||
| 165 | # language: ru |
||
| 166 | Функционал: Internal operations |
||
| 167 | In order to stay secret |
||
| 168 | As a secret organization |
||
| 169 | We need to be able to erase past agents' memory |
||
| 170 | |||
| 171 | Предыстория: |
||
| 172 | Допустим there is agent A |
||
| 173 | И there is agent B |
||
| 174 | |||
| 175 | Сценарий: Erasing agent memory |
||
| 176 | Допустим there is agent J |
||
| 177 | И there is agent K |
||
| 178 | Если I erase agent K's memory |
||
| 179 | @ I erase agent K's memory |
||
| 180 | То there should be agent J |
||
| 181 | Но there should not be agent K |
||
| 182 | |||
| 183 | История: Erasing agent memory |
||
| 184 | Допустим there is agent J |
||
| 185 | И there is agent K |
||
| 186 | Если I erase agent K's memory |
||
| 187 | @ I erase agent K's memory |
||
| 188 | То there should be agent J |
||
| 189 | Но there should not be agent K |
||
| 190 | |||
| 191 | Структура сценария: Erasing other agents' memory |
||
| 192 | Допустим there is agent <agent1> |
||
| 193 | И there is agent <agent2> |
||
| 194 | Если I erase agent <agent2>'s memory |
||
| 195 | @ I erase agent <agent2>'s memory |
||
| 196 | То there should be agent <agent1> |
||
| 197 | Но there should not be agent <agent2> |
||
| 198 | |||
| 199 | Значения: |
||
| 200 | | agent1 | agent2 | |
||
| 201 | | D | M | |
||
| 202 | |||
| 203 | Аутлайн: Erasing other agents' memory |
||
| 204 | Допустим there is agent <agent1> |
||
| 205 | И there is agent <agent2> |
||
| 206 | Если I erase agent <agent2>'s memory |
||
| 207 | @ I erase agent <agent2>'s memory |
||
| 208 | То there should be agent <agent1> |
||
| 209 | Но there should not be agent <agent2> |
||
| 210 | |||
| 211 | Значения: |
||
| 212 | | agent1 | agent2 | |
||
| 213 | | D | M | |
||
| 214 | GHERKIN |
||
| 215 | , <<<GHERKIN |
||
| 216 | # language: ru |
||
| 217 | Фича: Internal operations |
||
| 218 | In order to stay secret |
||
| 219 | As a secret organization |
||
| 220 | We need to be able to erase past agents' memory |
||
| 221 | |||
| 222 | Предыстория: |
||
| 223 | Допустим there is agent A |
||
| 224 | И there is agent B |
||
| 225 | |||
| 226 | Сценарий: Erasing agent memory |
||
| 227 | Допустим there is agent J |
||
| 228 | И there is agent K |
||
| 229 | Если I erase agent K's memory |
||
| 230 | @ I erase agent K's memory |
||
| 231 | То there should be agent J |
||
| 232 | Но there should not be agent K |
||
| 233 | |||
| 234 | История: Erasing agent memory |
||
| 235 | Допустим there is agent J |
||
| 236 | И there is agent K |
||
| 237 | Если I erase agent K's memory |
||
| 238 | @ I erase agent K's memory |
||
| 239 | То there should be agent J |
||
| 240 | Но there should not be agent K |
||
| 241 | |||
| 242 | Структура сценария: Erasing other agents' memory |
||
| 243 | Допустим there is agent <agent1> |
||
| 244 | И there is agent <agent2> |
||
| 245 | Если I erase agent <agent2>'s memory |
||
| 246 | @ I erase agent <agent2>'s memory |
||
| 247 | То there should be agent <agent1> |
||
| 248 | Но there should not be agent <agent2> |
||
| 249 | |||
| 250 | Значения: |
||
| 251 | | agent1 | agent2 | |
||
| 252 | | D | M | |
||
| 253 | |||
| 254 | Аутлайн: Erasing other agents' memory |
||
| 255 | Допустим there is agent <agent1> |
||
| 256 | И there is agent <agent2> |
||
| 257 | Если I erase agent <agent2>'s memory |
||
| 258 | @ I erase agent <agent2>'s memory |
||
| 259 | То there should be agent <agent1> |
||
| 260 | Но there should not be agent <agent2> |
||
| 261 | |||
| 262 | Значения: |
||
| 263 | | agent1 | agent2 | |
||
| 264 | | D | M | |
||
| 265 | GHERKIN |
||
| 266 | ); |
||
| 267 | |||
| 268 | $this->assertEquals($etalon, $dumped); |
||
| 269 | } |
||
| 270 | } |
||
| 271 |