Completed
Push — scalar-types/currency ( d4a290...08e1db )
by Kamil
25:05 queued 02:52
created

ChannelFactorySpec   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 2
dl 0
loc 28
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A let() 0 4 1
A it_implements_channel_factory_interface() 0 4 1
A it_creates_channel_with_name() 0 8 1
A it_creates_empty_channel() 0 6 1
1
<?php
2
3
/*
4
 * This file is part of the Sylius package.
5
 *
6
 * (c) Paweł Jędrzejewski
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
declare(strict_types=1);
13
14
namespace spec\Sylius\Component\Channel\Factory;
15
16
use PhpSpec\ObjectBehavior;
17
use Sylius\Component\Channel\Factory\ChannelFactoryInterface;
18
use Sylius\Component\Channel\Model\ChannelInterface;
19
use Sylius\Component\Resource\Factory\FactoryInterface;
20
21
/**
22
 * @author Arkadiusz Krakowiak <[email protected]>
23
 */
24
final class ChannelFactorySpec extends ObjectBehavior
25
{
26
    function let(FactoryInterface $defaultFactory): void
27
    {
28
        $this->beConstructedWith($defaultFactory);
29
    }
30
31
    function it_implements_channel_factory_interface(): void
32
    {
33
        $this->shouldImplement(ChannelFactoryInterface::class);
34
    }
35
36
    function it_creates_channel_with_name($defaultFactory, ChannelInterface $channel): void
37
    {
38
        $defaultFactory->createNew()->willReturn($channel);
39
40
        $channel->setName('United States Webstore')->shouldBeCalled();
41
42
        $this->createNamed('United States Webstore')->shouldReturn($channel);
43
    }
44
45
    function it_creates_empty_channel($defaultFactory, ChannelInterface $channel): void
46
    {
47
        $defaultFactory->createNew()->willReturn($channel);
48
49
        $this->createNew()->shouldReturn($channel);
50
    }
51
}
52