Completed
Branch master (734dbe)
by G
12:13
created

ProductVariantSpec   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 17
c 1
b 0
f 1
dl 0
loc 42
rs 10
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A it_has_no_default_channel_deposits() 0 4 1
A it_has_channel_deposit_for_channel() 0 15 1
A it_is_sylius_product_variant() 0 3 1
A it_has_tax_category() 0 7 1
A it_implements_product_variant_interface() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace spec\Gweb\SyliusProductDepositPlugin\Entity;
6
7
use Doctrine\Common\Collections\Collection;
8
use Gweb\SyliusProductDepositPlugin\Entity\ChannelDepositInterface;
9
10
use Gweb\SyliusProductDepositPlugin\Entity\ProductVariant;
11
use Gweb\SyliusProductDepositPlugin\Entity\ProductVariantInterface;
12
use PhpSpec\ObjectBehavior;
13
use Sylius\Component\Core\Model\ChannelInterface;
14
use Sylius\Component\Taxation\Model\TaxCategoryInterface;
15
16
final class ProductVariantSpec extends ObjectBehavior
17
{
18
    function it_is_sylius_product_variant(): 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...
19
    {
20
        $this->shouldHaveType(ProductVariant::class);
21
    }
22
23
    function it_implements_product_variant_interface(): void
24
    {
25
        $this->shouldImplement(ProductVariantInterface::class);
26
    }
27
28
    function it_has_no_default_channel_deposits(): void
29
    {
30
        $this->getChannelDeposits()->shouldReturnAnInstanceOf(Collection::class);
0 ignored issues
show
Bug introduced by
The method getChannelDeposits() does not exist on spec\Gweb\SyliusProductD...tity\ProductVariantSpec. 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

30
        $this->/** @scrutinizer ignore-call */ 
31
               getChannelDeposits()->shouldReturnAnInstanceOf(Collection::class);
Loading history...
31
        $this->getChannelDeposits()->shouldHaveCount(0);
32
    }
33
34
    function it_has_channel_deposit_for_channel(ChannelInterface $channel, ChannelDepositInterface $channelDeposit): void
35
    {
36
        $this->getChannelDepositForChannel($channel)->shouldReturn(null);
0 ignored issues
show
Bug introduced by
The method getChannelDepositForChannel() does not exist on spec\Gweb\SyliusProductD...tity\ProductVariantSpec. 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

36
        $this->/** @scrutinizer ignore-call */ 
37
               getChannelDepositForChannel($channel)->shouldReturn(null);
Loading history...
37
38
        $this->addChannelDeposit($channelDeposit);
0 ignored issues
show
Bug introduced by
The method addChannelDeposit() does not exist on spec\Gweb\SyliusProductD...tity\ProductVariantSpec. 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

38
        $this->/** @scrutinizer ignore-call */ 
39
               addChannelDeposit($channelDeposit);
Loading history...
39
40
        $this->hasChannelDeposit($channelDeposit)->shouldReturn(true);
0 ignored issues
show
Bug introduced by
The method hasChannelDeposit() does not exist on spec\Gweb\SyliusProductD...tity\ProductVariantSpec. 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

40
        $this->/** @scrutinizer ignore-call */ 
41
               hasChannelDeposit($channelDeposit)->shouldReturn(true);
Loading history...
41
        $this->hasChannelDepositForChannel($channel)->shouldReturn(true);
0 ignored issues
show
Bug introduced by
The method hasChannelDepositForChannel() does not exist on spec\Gweb\SyliusProductD...tity\ProductVariantSpec. 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

41
        $this->/** @scrutinizer ignore-call */ 
42
               hasChannelDepositForChannel($channel)->shouldReturn(true);
Loading history...
42
43
        $this->getChannelDepositForChannel($channel)->shouldReturn($channelDeposit);
44
45
        $this->removeChannelDeposit($channelDeposit);
0 ignored issues
show
Bug introduced by
The method removeChannelDeposit() does not exist on spec\Gweb\SyliusProductD...tity\ProductVariantSpec. 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

45
        $this->/** @scrutinizer ignore-call */ 
46
               removeChannelDeposit($channelDeposit);
Loading history...
46
47
        $this->hasChannelDeposit($channelDeposit)->shouldReturn(false);
48
        $this->hasChannelDepositForChannel($channel)->shouldReturn(false);
49
    }
50
51
    function it_has_tax_category(TaxCategoryInterface $taxCategory): void
52
    {
53
        $this->getDepositTaxCategory()->shouldReturn(null);
0 ignored issues
show
Bug introduced by
The method getDepositTaxCategory() does not exist on spec\Gweb\SyliusProductD...tity\ProductVariantSpec. 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

53
        $this->/** @scrutinizer ignore-call */ 
54
               getDepositTaxCategory()->shouldReturn(null);
Loading history...
54
        $this->setDepositTaxCategory(null);
0 ignored issues
show
Bug introduced by
The method setDepositTaxCategory() does not exist on spec\Gweb\SyliusProductD...tity\ProductVariantSpec. 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

54
        $this->/** @scrutinizer ignore-call */ 
55
               setDepositTaxCategory(null);
Loading history...
55
56
        $this->setDepositTaxCategory($taxCategory);
57
        $this->getDepositTaxCategory()->shouldReturn($taxCategory);
58
    }
59
}
60