Passed
Push — master ( 82dae2...f5a40a )
by
unknown
04:01
created

VendorSpec::it_is_initializable()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace spec\Odiseo\SyliusVendorPlugin\Model;
4
5
use Odiseo\SyliusVendorPlugin\Model\Vendor;
6
use Odiseo\SyliusVendorPlugin\Model\VendorInterface;
7
use Odiseo\SyliusVendorPlugin\Model\VendorTranslationInterface;
8
use PhpSpec\ObjectBehavior;
9
use Sylius\Component\Core\Model\ChannelInterface;
10
use Sylius\Component\Core\Model\ProductInterface;
11
use Sylius\Component\Resource\Model\ResourceInterface;
12
use Sylius\Component\Resource\Model\SlugAwareInterface;
13
use Sylius\Component\Resource\Model\TimestampableInterface;
14
use Sylius\Component\Resource\Model\ToggleableInterface;
15
use Sylius\Component\Resource\Model\TranslatableInterface;
16
use Symfony\Component\HttpFoundation\File\File;
17
18
class VendorSpec extends ObjectBehavior
19
{
20
    function it_is_initializable()
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...
21
    {
22
        $this->shouldHaveType(Vendor::class);
23
    }
24
25
    function it_implements_vendor_interface(): void
26
    {
27
        $this->shouldImplement(VendorInterface::class);
28
    }
29
30
    function it_implements_vendor_translation_interface(): void
31
    {
32
        $this->shouldImplement(VendorTranslationInterface::class);
33
    }
34
35
    function it_implements_translatable_interface(): void
36
    {
37
        $this->shouldImplement(TranslatableInterface::class);
38
    }
39
40
    function it_implements_toggleable_interface(): void
41
    {
42
        $this->shouldImplement(ToggleableInterface::class);
43
    }
44
45
    function it_implements_resource_interface(): void
46
    {
47
        $this->shouldImplement(ResourceInterface::class);
48
    }
49
50
    function it_implements_slug_aware_interface(): void
51
    {
52
        $this->shouldImplement(SlugAwareInterface::class);
53
    }
54
55
    function it_implements_timestamplable_interface(): void
56
    {
57
        $this->shouldImplement(TimestampableInterface::class);
58
    }
59
60
    function it_has_no_id_by_default(): void
61
    {
62
        $this->getId()->shouldReturn(null);
0 ignored issues
show
Bug introduced by
The method getId() does not exist on spec\Odiseo\SyliusVendorPlugin\Model\VendorSpec. 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

62
        $this->/** @scrutinizer ignore-call */ 
63
               getId()->shouldReturn(null);
Loading history...
63
    }
64
65
    function it_has_no_name_by_default(): void
66
    {
67
        $this->getName()->shouldReturn(null);
0 ignored issues
show
Bug introduced by
The method getName() does not exist on spec\Odiseo\SyliusVendorPlugin\Model\VendorSpec. 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

67
        $this->/** @scrutinizer ignore-call */ 
68
               getName()->shouldReturn(null);
Loading history...
68
    }
69
70
    function it_is_timestampable(): void
71
    {
72
        $dateTime = new \DateTime();
73
        $this->setCreatedAt($dateTime);
0 ignored issues
show
Bug introduced by
The method setCreatedAt() does not exist on spec\Odiseo\SyliusVendorPlugin\Model\VendorSpec. 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

73
        $this->/** @scrutinizer ignore-call */ 
74
               setCreatedAt($dateTime);
Loading history...
74
        $this->getCreatedAt()->shouldReturn($dateTime);
0 ignored issues
show
Bug introduced by
The method getCreatedAt() does not exist on spec\Odiseo\SyliusVendorPlugin\Model\VendorSpec. 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

74
        $this->/** @scrutinizer ignore-call */ 
75
               getCreatedAt()->shouldReturn($dateTime);
Loading history...
75
        $this->setUpdatedAt($dateTime);
0 ignored issues
show
Bug introduced by
The method setUpdatedAt() does not exist on spec\Odiseo\SyliusVendorPlugin\Model\VendorSpec. 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

75
        $this->/** @scrutinizer ignore-call */ 
76
               setUpdatedAt($dateTime);
Loading history...
76
        $this->getUpdatedAt()->shouldReturn($dateTime);
0 ignored issues
show
Bug introduced by
The method getUpdatedAt() does not exist on spec\Odiseo\SyliusVendorPlugin\Model\VendorSpec. 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

76
        $this->/** @scrutinizer ignore-call */ 
77
               getUpdatedAt()->shouldReturn($dateTime);
Loading history...
77
    }
78
79
    function it_toggles(): void
80
    {
81
        $this->enable();
0 ignored issues
show
Bug introduced by
The method enable() does not exist on spec\Odiseo\SyliusVendorPlugin\Model\VendorSpec. 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

81
        $this->/** @scrutinizer ignore-call */ 
82
               enable();
Loading history...
82
        $this->isEnabled()->shouldReturn(true);
0 ignored issues
show
Bug introduced by
The method isEnabled() does not exist on spec\Odiseo\SyliusVendorPlugin\Model\VendorSpec. 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

82
        $this->/** @scrutinizer ignore-call */ 
83
               isEnabled()->shouldReturn(true);
Loading history...
83
        $this->disable();
0 ignored issues
show
Bug introduced by
The method disable() does not exist on spec\Odiseo\SyliusVendorPlugin\Model\VendorSpec. 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

83
        $this->/** @scrutinizer ignore-call */ 
84
               disable();
Loading history...
84
        $this->isEnabled()->shouldReturn(false);
85
    }
86
87
    function it_allows_access_via_properties(): void
88
    {
89
        $this->setName('Vendor');
0 ignored issues
show
Bug introduced by
The method setName() does not exist on spec\Odiseo\SyliusVendorPlugin\Model\VendorSpec. 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

89
        $this->/** @scrutinizer ignore-call */ 
90
               setName('Vendor');
Loading history...
90
        $this->getName()->shouldReturn('Vendor');
91
        $this->setSlug('vendor');
0 ignored issues
show
Bug introduced by
The method setSlug() does not exist on spec\Odiseo\SyliusVendorPlugin\Model\VendorSpec. 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

91
        $this->/** @scrutinizer ignore-call */ 
92
               setSlug('vendor');
Loading history...
92
        $this->getSlug()->shouldReturn('vendor');
0 ignored issues
show
Bug introduced by
The method getSlug() does not exist on spec\Odiseo\SyliusVendorPlugin\Model\VendorSpec. 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

92
        $this->/** @scrutinizer ignore-call */ 
93
               getSlug()->shouldReturn('vendor');
Loading history...
93
        $this->setEmail('[email protected]');
0 ignored issues
show
Bug introduced by
The method setEmail() does not exist on spec\Odiseo\SyliusVendorPlugin\Model\VendorSpec. 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

93
        $this->/** @scrutinizer ignore-call */ 
94
               setEmail('[email protected]');
Loading history...
94
        $this->getEmail()->shouldReturn('[email protected]');
0 ignored issues
show
Bug introduced by
The method getEmail() does not exist on spec\Odiseo\SyliusVendorPlugin\Model\VendorSpec. 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

94
        $this->/** @scrutinizer ignore-call */ 
95
               getEmail()->shouldReturn('[email protected]');
Loading history...
95
96
        $file = new File(__DIR__ . '/VendorSpec.php');
97
        $this->setLogoFile($file);
0 ignored issues
show
Bug introduced by
The method setLogoFile() does not exist on spec\Odiseo\SyliusVendorPlugin\Model\VendorSpec. 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

97
        $this->/** @scrutinizer ignore-call */ 
98
               setLogoFile($file);
Loading history...
98
        $this->getLogoFile()->shouldReturn($file);
0 ignored issues
show
Bug introduced by
The method getLogoFile() does not exist on spec\Odiseo\SyliusVendorPlugin\Model\VendorSpec. 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

98
        $this->/** @scrutinizer ignore-call */ 
99
               getLogoFile()->shouldReturn($file);
Loading history...
99
100
        $this->setLogoName('Odiseo logo');
0 ignored issues
show
Bug introduced by
The method setLogoName() does not exist on spec\Odiseo\SyliusVendorPlugin\Model\VendorSpec. 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

100
        $this->/** @scrutinizer ignore-call */ 
101
               setLogoName('Odiseo logo');
Loading history...
101
        $this->getLogoName()->shouldReturn('Odiseo logo');
0 ignored issues
show
Bug introduced by
The method getLogoName() does not exist on spec\Odiseo\SyliusVendorPlugin\Model\VendorSpec. 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

101
        $this->/** @scrutinizer ignore-call */ 
102
               getLogoName()->shouldReturn('Odiseo logo');
Loading history...
102
    }
103
104
    function it_associates_channels(ChannelInterface $channel): void
105
    {
106
        $this->getChannels()->shouldHaveCount(0);
0 ignored issues
show
Bug introduced by
The method getChannels() does not exist on spec\Odiseo\SyliusVendorPlugin\Model\VendorSpec. 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

106
        $this->/** @scrutinizer ignore-call */ 
107
               getChannels()->shouldHaveCount(0);
Loading history...
107
        $this->addChannel($channel);
0 ignored issues
show
Bug introduced by
The method addChannel() does not exist on spec\Odiseo\SyliusVendorPlugin\Model\VendorSpec. 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

107
        $this->/** @scrutinizer ignore-call */ 
108
               addChannel($channel);
Loading history...
108
        $this->getChannels()->shouldHaveCount(1);
109
        $this->removeChannel($channel);
0 ignored issues
show
Bug introduced by
The method removeChannel() does not exist on spec\Odiseo\SyliusVendorPlugin\Model\VendorSpec. 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

109
        $this->/** @scrutinizer ignore-call */ 
110
               removeChannel($channel);
Loading history...
110
        $this->getChannels()->shouldHaveCount(0);
111
    }
112
113
    function it_associates_products(ProductInterface $product): void
114
    {
115
        $this->getProducts()->shouldHaveCount(0);
0 ignored issues
show
Bug introduced by
The method getProducts() does not exist on spec\Odiseo\SyliusVendorPlugin\Model\VendorSpec. 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

115
        $this->/** @scrutinizer ignore-call */ 
116
               getProducts()->shouldHaveCount(0);
Loading history...
116
        $this->addProduct($product);
0 ignored issues
show
Bug introduced by
The method addProduct() does not exist on spec\Odiseo\SyliusVendorPlugin\Model\VendorSpec. 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

116
        $this->/** @scrutinizer ignore-call */ 
117
               addProduct($product);
Loading history...
117
        $this->getProducts()->shouldHaveCount(1);
118
        $this->removeProduct($product);
0 ignored issues
show
Bug introduced by
The method removeProduct() does not exist on spec\Odiseo\SyliusVendorPlugin\Model\VendorSpec. 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

118
        $this->/** @scrutinizer ignore-call */ 
119
               removeProduct($product);
Loading history...
119
        $this->getProducts()->shouldHaveCount(0);
120
    }
121
}
122