Passed
Pull Request — master (#157)
by
unknown
07:07
created

ProductAttributesByTaxonQueryBuilderSpec   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 24
rs 10
c 0
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A it_implements_query_builder_interface() 0 3 1
A it_is_initializable() 0 3 1
A let() 0 3 1
A it_builds_query() 0 7 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\ProductAttributesByTaxonQueryBuilder;
16
use BitBag\SyliusElasticsearchPlugin\QueryBuilder\QueryBuilderInterface;
17
use Elastica\Query\AbstractQuery;
18
use Elastica\Query\BoolQuery;
19
use PhpSpec\ObjectBehavior;
20
21
final class ProductAttributesByTaxonQueryBuilderSpec extends ObjectBehavior
22
{
23
    function let(QueryBuilderInterface $hasTaxonQueryBuilder): 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...
24
    {
25
        $this->beConstructedWith($hasTaxonQueryBuilder);
26
    }
27
28
    function it_is_initializable(): 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...
29
    {
30
        $this->shouldHaveType(ProductAttributesByTaxonQueryBuilder::class);
31
    }
32
33
    function it_implements_query_builder_interface(): void
34
    {
35
        $this->shouldHaveType(QueryBuilderInterface::class);
36
    }
37
38
    function it_builds_query(
39
        QueryBuilderInterface $hasTaxonQueryBuilder,
40
        AbstractQuery $taxonQuery
41
    ): void {
42
        $hasTaxonQueryBuilder->buildQuery([])->willReturn($taxonQuery);
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

42
        $hasTaxonQueryBuilder->buildQuery([])->/** @scrutinizer ignore-call */ willReturn($taxonQuery);

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...
43
44
        $this->buildQuery([])->shouldBeAnInstanceOf(BoolQuery::class);
0 ignored issues
show
Bug introduced by
The method buildQuery() does not exist on spec\BitBag\SyliusElasti...ByTaxonQueryBuilderSpec. 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

44
        $this->/** @scrutinizer ignore-call */ 
45
               buildQuery([])->shouldBeAnInstanceOf(BoolQuery::class);
Loading history...
45
    }
46
}
47