We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
| Conditions | 1 |
| Paths | 1 |
| Total Lines | 100 |
| Code Lines | 45 |
| 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 |
||
| 180 | public function testContainsCorrectField() |
||
| 181 | { |
||
| 182 | $query = <<<'EOF' |
||
| 183 | { |
||
| 184 | __schema { |
||
| 185 | mutationType { |
||
| 186 | fields { |
||
| 187 | name |
||
| 188 | args { |
||
| 189 | name |
||
| 190 | type { |
||
| 191 | name |
||
| 192 | kind |
||
| 193 | ofType { |
||
| 194 | name |
||
| 195 | kind |
||
| 196 | } |
||
| 197 | } |
||
| 198 | } |
||
| 199 | type { |
||
| 200 | name |
||
| 201 | kind |
||
| 202 | } |
||
| 203 | } |
||
| 204 | } |
||
| 205 | } |
||
| 206 | } |
||
| 207 | EOF; |
||
| 208 | |||
| 209 | $expectedData = [ |
||
| 210 | '__schema' => [ |
||
| 211 | 'mutationType' => [ |
||
| 212 | 'fields' => [ |
||
| 213 | [ |
||
| 214 | 'name' => 'simpleMutation', |
||
| 215 | 'args' => [ |
||
| 216 | [ |
||
| 217 | 'name' => 'input', |
||
| 218 | 'type' => [ |
||
| 219 | 'name' => null, |
||
| 220 | 'kind' => 'NON_NULL', |
||
| 221 | 'ofType' => [ |
||
| 222 | 'name' => 'simpleMutationInput', |
||
| 223 | 'kind' => 'INPUT_OBJECT', |
||
| 224 | ], |
||
| 225 | ], |
||
| 226 | ], |
||
| 227 | ], |
||
| 228 | 'type' => [ |
||
| 229 | 'name' => 'simpleMutationPayload', |
||
| 230 | 'kind' => 'OBJECT', |
||
| 231 | ], |
||
| 232 | ], |
||
| 233 | [ |
||
| 234 | 'name' => 'simpleMutationWithThunkFields', |
||
| 235 | 'args' => [ |
||
| 236 | [ |
||
| 237 | 'name' => 'input', |
||
| 238 | 'type' => [ |
||
| 239 | 'name' => null, |
||
| 240 | 'kind' => 'NON_NULL', |
||
| 241 | 'ofType' => [ |
||
| 242 | 'name' => 'simpleMutationWithThunkFieldsInput', |
||
| 243 | 'kind' => 'INPUT_OBJECT', |
||
| 244 | ], |
||
| 245 | ], |
||
| 246 | ], |
||
| 247 | ], |
||
| 248 | 'type' => [ |
||
| 249 | 'name' => 'simpleMutationWithThunkFieldsPayload', |
||
| 250 | 'kind' => 'OBJECT', |
||
| 251 | ], |
||
| 252 | ], |
||
| 253 | [ |
||
| 254 | 'name' => 'simplePromiseMutation', |
||
| 255 | 'args' => [ |
||
| 256 | [ |
||
| 257 | 'name' => 'input', |
||
| 258 | 'type' => [ |
||
| 259 | 'name' => null, |
||
| 260 | 'kind' => 'NON_NULL', |
||
| 261 | 'ofType' => [ |
||
| 262 | 'name' => 'simplePromiseMutationInput', |
||
| 263 | 'kind' => 'INPUT_OBJECT', |
||
| 264 | ], |
||
| 265 | ], |
||
| 266 | ], |
||
| 267 | ], |
||
| 268 | 'type' => [ |
||
| 269 | 'name' => 'simplePromiseMutationPayload', |
||
| 270 | 'kind' => 'OBJECT', |
||
| 271 | ], |
||
| 272 | ], |
||
| 273 | ], |
||
| 274 | ], |
||
| 275 | ], |
||
| 276 | ]; |
||
| 277 | |||
| 278 | $this->assertGraphQL($query, $expectedData); |
||
| 279 | } |
||
| 280 | } |
||
| 281 |