Conditions | 1 |
Paths | 1 |
Total Lines | 60 |
Code Lines | 58 |
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 |
||
115 | private function setBuildCalls(): void |
||
116 | { |
||
117 | $this->listLocatorMock->expects($this->once()) |
||
118 | ->method('get') |
||
119 | ->with('test_list') |
||
120 | ->willReturn($this->listMock); |
||
121 | $this->configMock->expects($this->once()) |
||
122 | ->method('resolve') |
||
123 | ->with($this->listMock); |
||
124 | $this->listMock->expects($this->once()) |
||
125 | ->method('setParameters') |
||
126 | ->with(['param1' => 'foo', 'param2' => 'bar']); |
||
127 | $this->typeResolverMock->expects($this->once()) |
||
128 | ->method('resolveType') |
||
129 | ->with('list_type') |
||
130 | ->willReturnSelf(); |
||
131 | $this->typeResolverMock->expects($this->once()) |
||
132 | ->method('getTypeName') |
||
133 | ->willReturn('list_type'); |
||
134 | $this->typeResolverMock->expects($this->once()) |
||
135 | ->method('getPerPage') |
||
136 | ->willReturn(20); |
||
137 | $this->typeResolverMock->expects($this->once()) |
||
138 | ->method('getCurrentPage') |
||
139 | ->willReturn(5); |
||
140 | $this->mapperFactoryMock->expects($this->once()) |
||
141 | ->method('createListMapper') |
||
142 | ->with($this->listMock, 'list_type') |
||
143 | ->willReturn($this->listMapperMock); |
||
144 | $this->mapperFactoryMock->expects($this->once()) |
||
145 | ->method('createFilterMapper') |
||
146 | ->with($this->listMock) |
||
147 | ->willReturn($this->filterMapperMock); |
||
148 | $this->mapperFactoryMock->expects($this->once()) |
||
149 | ->method('createJoinMapper') |
||
150 | ->with($this->listMock, $this->listMapperMock, $this->filterMapperMock, $this->valueMock) |
||
151 | ->willReturn($this->joinMapperMock); |
||
152 | $this->filterBuilderMock->expects($this->once()) |
||
153 | ->method('buildFilterForm') |
||
154 | ->with($this->filterMapperMock) |
||
155 | ->willReturn($this->filterFormMock); |
||
156 | $this->requestHandlerMock->expects($this->once()) |
||
157 | ->method('handleRequest') |
||
158 | ->with($this->listMapperMock, $this->filterMapperMock, $this->filterFormMock); |
||
159 | $this->valueFactoryMock->expects($this->once()) |
||
160 | ->method('createListValue') |
||
161 | ->with($this->listMapperMock, $this->filterMapperMock) |
||
162 | ->willReturn($this->valueMock); |
||
163 | $this->listQueryBuilderMock->expects($this->once()) |
||
164 | ->method('buildQuery') |
||
165 | ->with($this->listMock, $this->joinMapperMock, $this->listMapperMock, $this->filterMapperMock, $this->valueMock) |
||
166 | ->willReturn($this->queryBuilderMock); |
||
167 | $this->listQueryBuilderMock->expects($this->once()) |
||
168 | ->method('buildLazyQuery') |
||
169 | ->with($this->listMock, $this->joinMapperMock, $this->listMapperMock) |
||
170 | ->willReturn($this->lazyQueryBuilderMock); |
||
171 | $this->viewFactoryMock->expects($this->once()) |
||
172 | ->method('createView') |
||
173 | ->with($this->listMapperMock, $this->filterFormMock, $this->queryBuilderMock, $this->lazyQueryBuilderMock, 20, 5) |
||
174 | ->willReturn($this->viewMock); |
||
175 | } |
||
192 |