Completed
Push — master ( 860366...55daec )
by Kamil
19:37
created

DefaultChannelFactorySpec   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 2
Bugs 0 Features 1
Metric Value
wmc 4
c 2
b 0
f 1
lcom 0
cbo 2
dl 0
loc 30
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A let() 0 4 1
A it_is_initializable() 0 4 1
A it_implements_default_channel_factory_interface() 0 4 1
A it_creates_default_channel_and_persist_it() 0 12 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
namespace spec\Sylius\Component\Core\Test\Services;
13
14
use PhpSpec\ObjectBehavior;
15
use Sylius\Component\Channel\Factory\ChannelFactoryInterface;
16
use Sylius\Component\Core\Model\ChannelInterface;
17
use Sylius\Component\Core\Test\Services\DefaultChannelFactoryInterface;
18
use Sylius\Component\Resource\Repository\RepositoryInterface;
19
20
/**
21
 * @author Mateusz Zalewski <[email protected]>
22
 */
23
class DefaultChannelFactorySpec extends ObjectBehavior
24
{
25
    function let(ChannelFactoryInterface $channelFactory, RepositoryInterface $channelRepository)
26
    {
27
        $this->beConstructedWith($channelFactory, $channelRepository);
28
    }
29
30
    function it_is_initializable()
31
    {
32
        $this->shouldHaveType('Sylius\Component\Core\Test\Services\DefaultChannelFactory');
33
    }
34
35
    function it_implements_default_channel_factory_interface()
36
    {
37
        $this->shouldImplement(DefaultChannelFactoryInterface::class);
38
    }
39
40
    function it_creates_default_channel_and_persist_it(
41
        $channelFactory,
42
        $channelRepository,
43
        ChannelInterface $channel
44
    ) {
45
        $channelFactory->createNamed('Default')->willReturn($channel);
46
47
        $channel->setCode('DEFAULT')->shouldBeCalled();
48
        $channelRepository->add($channel)->shouldBeCalled();
49
50
        $this->create()->shouldReturn(['channel' => $channel]);
51
    }
52
}
53