ProductVariantsDepositHelperSpec   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 10
dl 0
loc 41
rs 10
c 0
b 0
f 0
wmc 6

6 Methods

Rating   Name   Duplication   Size   Complexity  
A it_is_initializable() 0 3 1
A it_returns_single_product_variant_deposit_price() 0 7 1
A it_extends_templating_helper() 0 3 1
A it_returns_all_product_variants_deposit_prices() 0 9 1
A it_has_name() 0 3 1
A let() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace spec\Gewebe\SyliusProductDepositPlugin\Templating\Helper;
6
7
use Gewebe\SyliusProductDepositPlugin\Entity\ProductVariantInterface;
8
use Gewebe\SyliusProductDepositPlugin\Provider\ProductVariantsDepositsProviderInterface;
9
use Gewebe\SyliusProductDepositPlugin\Templating\Helper\ProductVariantsDepositHelper;
10
use PhpSpec\ObjectBehavior;
11
use Sylius\Component\Core\Model\ChannelInterface;
12
use Sylius\Component\Core\Model\ProductInterface;
13
use Symfony\Component\Templating\Helper\Helper;
14
15
class ProductVariantsDepositHelperSpec extends ObjectBehavior
16
{
17
    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...
18
        ProductVariantsDepositsProviderInterface $productVariantsDepositsProvider
19
    ): void {
20
        $this->beConstructedWith($productVariantsDepositsProvider);
21
    }
22
23
    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...
24
    {
25
        $this->shouldHaveType(ProductVariantsDepositHelper::class);
26
    }
27
28
    function it_extends_templating_helper(): void
29
    {
30
        $this->shouldHaveType(Helper::class);
31
    }
32
33
    function it_returns_single_product_variant_deposit_price(
34
        ProductVariantInterface $productVariant,
35
        ChannelInterface $channel
36
    ): void {
37
        $productVariant->getDepositPriceByChannel($channel)->willReturn(50);
38
39
        $this->getDeposit($productVariant, $channel)->shouldReturn(50);
0 ignored issues
show
Bug introduced by
The method getDeposit() does not exist on spec\Gewebe\SyliusProduc...riantsDepositHelperSpec. 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

39
        $this->/** @scrutinizer ignore-call */ 
40
               getDeposit($productVariant, $channel)->shouldReturn(50);
Loading history...
40
    }
41
42
    function it_returns_all_product_variants_deposit_prices(
43
        ProductVariantsDepositsProviderInterface $productVariantsDepositsProvider,
44
        ProductInterface $product,
45
        ChannelInterface $channel
46
    ): void {
47
        $productVariantsDepositsProvider->provideVariantsDeposits($product, $channel)->willReturn([1 => 50, 2 => 100]);
48
        $this->beConstructedWith($productVariantsDepositsProvider);
49
50
        $this->getDepositsByProduct($product, $channel)->shouldReturn([1 => 50, 2 => 100]);
0 ignored issues
show
Bug introduced by
The method getDepositsByProduct() does not exist on spec\Gewebe\SyliusProduc...riantsDepositHelperSpec. 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
               getDepositsByProduct($product, $channel)->shouldReturn([1 => 50, 2 => 100]);
Loading history...
51
    }
52
53
    function it_has_name()
54
    {
55
        $this->getName()->shouldReturn('gewebe_product_variants_deposit');
0 ignored issues
show
Bug introduced by
The method getName() does not exist on spec\Gewebe\SyliusProduc...riantsDepositHelperSpec. 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

55
        $this->/** @scrutinizer ignore-call */ 
56
               getName()->shouldReturn('gewebe_product_variants_deposit');
Loading history...
56
    }
57
}
58