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

HasChannelQueryBuilderSpec   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 26
rs 10
wmc 4
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\HasChannelQueryBuilder;
16
use BitBag\SyliusElasticsearchPlugin\QueryBuilder\QueryBuilderInterface;
17
use Elastica\Query\Terms;
18
use PhpSpec\ObjectBehavior;
19
use Sylius\Component\Channel\Context\ChannelContextInterface;
20
use Sylius\Component\Core\Model\ChannelInterface;
21
22
final class HasChannelQueryBuilderSpec extends ObjectBehavior
23
{
24
    function let(ChannelContextInterface $channelContext): void
25
    {
26
        $this->beConstructedWith($channelContext, 'channel_property');
27
    }
28
29
    function it_is_initializable(): void
30
    {
31
        $this->shouldHaveType(HasChannelQueryBuilder::class);
32
    }
33
34
    function it_implements_query_builder_interface(): void
35
    {
36
        $this->shouldHaveType(QueryBuilderInterface::class);
37
    }
38
39
    function it_builds_query(
40
        ChannelContextInterface $channelContext,
41
        ChannelInterface $channel
42
    ): void {
43
        $channel->getCode()->willReturn('web');
44
45
        $channelContext->getChannel()->willReturn($channel);
46
47
        $this->buildQuery([])->shouldBeAnInstanceOf(Terms::class);
48
    }
49
}
50