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

ProductTaxonsMapperSpec::it_maps_to_unique_codes()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 5
c 1
b 0
f 0
nc 1
nop 3
dl 0
loc 14
rs 10
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\PropertyBuilder\Mapper;
14
15
use BitBag\SyliusElasticsearchPlugin\PropertyBuilder\Mapper\ProductTaxonsMapper;
16
use BitBag\SyliusElasticsearchPlugin\PropertyBuilder\Mapper\ProductTaxonsMapperInterface;
17
use Doctrine\Common\Collections\Collection;
18
use PhpSpec\ObjectBehavior;
19
use Sylius\Component\Core\Model\ProductInterface;
20
use Sylius\Component\Core\Model\TaxonInterface;
21
22
final class ProductTaxonsMapperSpec extends ObjectBehavior
23
{
24
    function it_is_initializable(): void
25
    {
26
        $this->shouldHaveType(ProductTaxonsMapper::class);
27
    }
28
29
    function it_implements_product_taxons_mapper_interface(): void
30
    {
31
        $this->shouldHaveType(ProductTaxonsMapperInterface::class);
32
    }
33
34
    function it_maps_to_unique_codes(
35
        ProductInterface $product,
36
        Collection $collection,
37
        TaxonInterface $taxon
38
    ): void {
39
        $taxon->getCode()->willReturn('book');
40
41
        $taxons = new \ArrayIterator([$taxon]);
42
43
        $collection->getIterator()->willReturn($taxons);
44
45
        $product->getTaxons()->willReturn($collection);
46
47
        $this->mapToUniqueCodes($product);
48
    }
49
}
50