Completed
Pull Request — master (#5)
by
unknown
05:17
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 0
Metric Value
cc 1
eloc 5
nc 1
nop 3
dl 0
loc 14
rs 9.4285
c 0
b 0
f 0
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
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...
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);
0 ignored issues
show
Bug introduced by
The method willReturn() does not exist on Traversable. It seems like you code against a sub-type of Traversable such as Nette\Utils\Finder or Nette\Utils\Html or Nette\Utils\ArrayList or Nette\Iterators\CachingIterator. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

43
        $collection->getIterator()->/** @scrutinizer ignore-call */ willReturn($taxons);
Loading history...
44
45
        $product->getTaxons()->willReturn($collection);
0 ignored issues
show
Bug introduced by
The method willReturn() does not exist on Doctrine\Common\Collections\Collection. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

45
        $product->getTaxons()->/** @scrutinizer ignore-call */ willReturn($collection);

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...
46
47
        $this->mapToUniqueCodes($product);
0 ignored issues
show
Bug introduced by
The method mapToUniqueCodes() does not exist on spec\BitBag\SyliusElasti...ProductTaxonsMapperSpec. 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

47
        $this->/** @scrutinizer ignore-call */ 
48
               mapToUniqueCodes($product);
Loading history...
48
    }
49
}
50