Passed
Push — master ( 979f6d...757493 )
by US
08:39 queued 11s
created

HasTaxonQueryBuilderSpec   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
c 1
b 0
f 0
dl 0
loc 27
rs 10
wmc 5
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
23
    {
24
        $this->beConstructedWith('taxons_property');
25
    }
26
27
    function it_is_initializable(): void
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([
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