Passed
Pull Request — master (#5)
by
unknown
04:17
created

HasTaxonQueryBuilderSpec   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 27
rs 10
c 0
b 0
f 0
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A it_implements_query_builder_interface() 0 3 1
A it_builds_returned_null_if_property_is_null() 0 3 1
A let() 0 3 1
A it_is_initializable() 0 3 1
A it_builds_query() 0 5 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\HasTaxonQueryBuilder;
16
use BitBag\SyliusElasticsearchPlugin\QueryBuilder\QueryBuilderInterface;
17
use Elastica\Query\Terms;
18
use PhpSpec\ObjectBehavior;
19
20
final class HasTaxonQueryBuilderSpec extends ObjectBehavior
21
{
22
    function let(): 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('taxons_property');
25
    }
26
27
    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...
28
    {
29
        $this->shouldHaveType(HasTaxonQueryBuilder::class);
30
    }
31
32
    function it_implements_query_builder_interface(): void
33
    {
34
        $this->shouldHaveType(QueryBuilderInterface::class);
35
    }
36
37
    function it_builds_query(): void
38
    {
39
        $this->buildQuery([
0 ignored issues
show
Bug introduced by
The method buildQuery() does not exist on spec\BitBag\SyliusElasti...asTaxonQueryBuilderSpec. 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

39
        $this->/** @scrutinizer ignore-call */ 
40
               buildQuery([
Loading history...
40
            'taxons_property' => 'book',
41
        ])->shouldBeAnInstanceOf(Terms::class);
42
    }
43
44
    function it_builds_returned_null_if_property_is_null(): void
45
    {
46
        $this->buildQuery(['taxons_property' => null])->shouldBeEqualTo(null);
47
    }
48
}
49