Passed
Pull Request — master (#157)
by
unknown
07:07
created

ProductAttributesContextSpec::it_gets_attributes()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 3
dl 0
loc 10
rs 10
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\Context;
14
15
use BitBag\SyliusElasticsearchPlugin\Context\ProductAttributesContext;
16
use BitBag\SyliusElasticsearchPlugin\Context\ProductAttributesContextInterface;
17
use BitBag\SyliusElasticsearchPlugin\Context\TaxonContextInterface;
18
use BitBag\SyliusElasticsearchPlugin\Finder\ProductAttributesFinderInterface;
19
use PhpSpec\ObjectBehavior;
20
use Sylius\Component\Core\Model\TaxonInterface;
21
22
final class ProductAttributesContextSpec extends ObjectBehavior
23
{
24
    function let(
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
        TaxonContextInterface $taxonContext,
26
        ProductAttributesFinderInterface $attributesFinder
27
    ): void {
28
        $this->beConstructedWith($taxonContext, $attributesFinder);
29
    }
30
31
    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...
32
    {
33
        $this->shouldHaveType(ProductAttributesContext::class);
34
    }
35
36
    function it_implements_product_attributes_context_interface(): void
37
    {
38
        $this->shouldHaveType(ProductAttributesContextInterface::class);
39
    }
40
41
    function it_gets_attributes(
42
        TaxonContextInterface $taxonContext,
43
        ProductAttributesFinderInterface $attributesFinder,
44
        TaxonInterface $taxon
45
    ): void {
46
        $taxonContext->getTaxon()->willReturn($taxon);
0 ignored issues
show
Bug introduced by
The method willReturn() does not exist on Sylius\Component\Core\Model\TaxonInterface. ( Ignorable by Annotation )

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

46
        $taxonContext->getTaxon()->/** @scrutinizer ignore-call */ willReturn($taxon);

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...
47
48
        $attributesFinder->findByTaxon($taxon)->willReturn([]);
49
50
        $this->getAttributes()->shouldBeEqualTo([]);
0 ignored issues
show
Bug introduced by
The method getAttributes() does not exist on spec\BitBag\SyliusElasti...ctAttributesContextSpec. 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

50
        $this->/** @scrutinizer ignore-call */ 
51
               getAttributes()->shouldBeEqualTo([]);
Loading history...
51
    }
52
}
53