Conditions | 1 |
Paths | 1 |
Total Lines | 56 |
Code Lines | 38 |
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 |
||
58 | public function testCustomConfig(): void |
||
59 | { |
||
60 | $customConfig = [ |
||
61 | 'types' => [ |
||
62 | 'list' => ArrayListType::class, |
||
63 | 'csv' => CsvListType::class |
||
64 | ], |
||
65 | 'list_config' => [ |
||
66 | 'translate' => true, |
||
67 | 'multi_column_sort' => true, |
||
68 | 'form_configuration' => [ |
||
69 | 'config' => 'value' |
||
70 | ], |
||
71 | 'request' => [ |
||
72 | 'filter' => 'new_filter' |
||
73 | ], |
||
74 | 'type_configuration' => [ |
||
75 | 'list' => [ |
||
76 | 'length' => 1000, |
||
77 | 'limit' => 10000 |
||
78 | ] |
||
79 | ] |
||
80 | ], |
||
81 | ]; |
||
82 | |||
83 | $expectedConfig = [ |
||
84 | 'types' => [ |
||
85 | 'list' => ArrayListType::class, |
||
86 | 'csv' => CsvListType::class |
||
87 | ], |
||
88 | 'list_config' => [ |
||
89 | 'identifier' => 'id', |
||
90 | 'alias' => 'l', |
||
91 | 'translate' => true, |
||
92 | 'translation_domain' => null, |
||
93 | 'multi_column_sort' => true, |
||
94 | 'form_configuration' => [ |
||
95 | 'config' => 'value' |
||
96 | ], |
||
97 | 'request' => [ |
||
98 | 'page' => 'page', |
||
99 | 'length' => 'length', |
||
100 | 'sort' => 'sort', |
||
101 | 'filter' => 'new_filter' |
||
102 | ], |
||
103 | 'type_configuration' => [ |
||
104 | 'list' => [ |
||
105 | 'length' => 1000, |
||
106 | 'limit' => 10000 |
||
107 | ] |
||
108 | ] |
||
109 | ], |
||
110 | ]; |
||
111 | |||
112 | $config = $this->processor->processConfiguration($this->configuration, ['povs_lister' => $customConfig]); |
||
113 | $this->assertEquals($expectedConfig, $config); |
||
114 | } |
||
116 |