| Conditions | 1 |
| Paths | 1 |
| Total Lines | 57 |
| Code Lines | 52 |
| 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 |
||
| 14 | public function test_reviews_restrict() |
||
| 15 | { |
||
| 16 | $postId = self::factory()->post->create(); |
||
| 17 | $termId = self::factory()->term->create(['taxonomy' => glsr()->taxonomy]); |
||
| 18 | $userId = self::factory()->user->create(); |
||
| 19 | $args = [ |
||
| 20 | 'assigned_to' => $postId, |
||
| 21 | 'block' => '', |
||
| 22 | 'category' => $termId, |
||
| 23 | 'class' => '', |
||
| 24 | 'display' => 1, |
||
| 25 | 'hide' => [], |
||
| 26 | 'id' => '', |
||
| 27 | 'offset' => '', |
||
| 28 | 'page' => 2, |
||
| 29 | 'pageUrl' => 'http://site-reviews.test/reviews/', |
||
| 30 | 'pagination' => 'ajax', |
||
| 31 | 'schema' => '', |
||
| 32 | 'terms' => '', |
||
| 33 | 'type' => 'local', |
||
| 34 | 'user' => $userId, |
||
| 35 | ]; |
||
| 36 | $expected = [ |
||
| 37 | 'assigned_posts' => [$postId], |
||
| 38 | 'assigned_posts_types' => [], |
||
| 39 | 'assigned_terms' => [$termId], |
||
| 40 | 'assigned_users' => [$userId], |
||
| 41 | 'content' => '', |
||
| 42 | 'date' => [ |
||
| 43 | 'after' => '', |
||
| 44 | 'before' => '', |
||
| 45 | 'day' => '', |
||
| 46 | 'inclusive' => '', |
||
| 47 | 'month' => '', |
||
| 48 | 'year' => '', |
||
| 49 | ], |
||
| 50 | 'email' => '', |
||
| 51 | 'integration' => '', |
||
| 52 | 'ip_address' => '', |
||
| 53 | 'offset' => 0, |
||
| 54 | 'order' => 'DESC', |
||
| 55 | 'orderby' => 'p.post_date', |
||
| 56 | 'page' => 2, |
||
| 57 | 'per_page' => 1, |
||
| 58 | 'post__in' => [], |
||
| 59 | 'post__not_in' => [], |
||
| 60 | 'rating' => 0, |
||
| 61 | 'rating_field' => 'rating', |
||
| 62 | 'status' => 1, |
||
| 63 | 'terms' => -1, |
||
| 64 | 'type' => 'local', |
||
| 65 | 'user__in' => [], |
||
| 66 | 'user__not_in' => [], |
||
| 67 | ]; |
||
| 68 | $test = glsr()->args(glsr(ReviewsDefaults::class)->restrict($args)); |
||
| 69 | $this->assertEquals(count($test), count(glsr(ReviewsDefaults::class)->defaults())); |
||
| 70 | $this->assertEquals($test->toArray(), $expected); |
||
| 71 | } |
||
| 118 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths