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