Completed
Push — master ( bbd2b1...f08c3b )
by Kamil
31:47 queued 09:37
created

UserWithEncoderFactorySpec   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 3
dl 0
loc 21
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A let() 0 4 1
A it_is_a_factory() 0 4 1
A it_sets_the_given_encoder_name_on_created_user() 0 8 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\Bundle\UserBundle\Factory;
15
16
use PhpSpec\ObjectBehavior;
17
use Sylius\Component\Resource\Factory\FactoryInterface;
18
use Sylius\Component\User\Model\UserInterface;
19
20
final class UserWithEncoderFactorySpec extends ObjectBehavior
21
{
22
    function let(FactoryInterface $decoratedUserFactory)
23
    {
24
        $this->beConstructedWith($decoratedUserFactory, 'encodername');
25
    }
26
27
    function it_is_a_factory(): void
28
    {
29
        $this->shouldHaveType(FactoryInterface::class);
30
    }
31
32
    function it_sets_the_given_encoder_name_on_created_user(FactoryInterface $decoratedUserFactory, UserInterface $user): void
33
    {
34
        $decoratedUserFactory->createNew()->willReturn($user);
35
36
        $user->setEncoderName('encodername')->shouldBeCalled();
37
38
        $this->createNew()->shouldReturn($user);
39
    }
40
}
41