Completed
Pull Request — master (#51)
by Konrad
03:32
created

ProductsByPartialNameQueryBuilderSpec   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 19
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A it_is_a_query_builder() 0 3 1
A it_builds_query() 0 7 1
A let() 0 3 1
1
<?php
2
3
/*
4
 * This file has been created by developers from BitBag.
5
 * Feel free to contact us once you face any issues or want to start
6
 * another great project.
7
 * You can find more information about us on https://bitbag.shop and write us
8
 * an email on [email protected].
9
 */
10
11
declare(strict_types=1);
12
13
namespace spec\BitBag\SyliusElasticsearchPlugin\QueryBuilder;
14
15
use BitBag\SyliusElasticsearchPlugin\QueryBuilder\QueryBuilderInterface;
16
use Elastica\Query\AbstractQuery;
17
use Elastica\Query\BoolQuery;
18
use PhpSpec\ObjectBehavior;
19
20
final class ProductsByPartialNameQueryBuilderSpec extends ObjectBehavior
21
{
22
    function let(QueryBuilderInterface $containsNameQueryBuilder): void
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
23
    {
24
        $this->beConstructedWith($containsNameQueryBuilder);
25
    }
26
27
    function it_is_a_query_builder(): void
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
28
    {
29
        $this->shouldImplement(QueryBuilderInterface::class);
30
    }
31
32
    function it_builds_query(
33
        QueryBuilderInterface $containsNameQueryBuilder,
34
        AbstractQuery $productsQuery
35
    ): void {
36
        $containsNameQueryBuilder->buildQuery([])->willReturn($productsQuery);
0 ignored issues
show
Bug introduced by
The method willReturn() does not exist on Elastica\Query\AbstractQuery. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

36
        $containsNameQueryBuilder->buildQuery([])->/** @scrutinizer ignore-call */ willReturn($productsQuery);

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
37
38
        $this->buildQuery([])->shouldBeAnInstanceOf(BoolQuery::class);
0 ignored issues
show
Bug introduced by
The method buildQuery() does not exist on spec\BitBag\SyliusElasti...ialNameQueryBuilderSpec. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

38
        $this->/** @scrutinizer ignore-call */ 
39
               buildQuery([])->shouldBeAnInstanceOf(BoolQuery::class);
Loading history...
39
    }
40
}
41