Completed
Push — 1.4-password-hashing ( c4872d )
by Kamil
11:17
created

UserWithEncoderFactorySpec   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 2
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
declare(strict_types=1);
4
5
namespace spec\Sylius\Bundle\UserBundle\Factory;
6
7
use PhpSpec\ObjectBehavior;
8
use Sylius\Component\Resource\Factory\FactoryInterface;
9
use Sylius\Component\User\Model\UserInterface;
10
11
final class UserWithEncoderFactorySpec extends ObjectBehavior
12
{
13
    function let(FactoryInterface $decoratedUserFactory)
14
    {
15
        $this->beConstructedWith($decoratedUserFactory, 'encodername');
16
    }
17
18
    function it_is_a_factory(): void
19
    {
20
        $this->shouldHaveType(FactoryInterface::class);
21
    }
22
23
    function it_sets_the_given_encoder_name_on_created_user(FactoryInterface $decoratedUserFactory, UserInterface $user): void
24
    {
25
        $decoratedUserFactory->createNew()->willReturn($user);
26
27
        $user->setEncoderName('encodername')->shouldBeCalled();
28
29
        $this->createNew()->shouldReturn($user);
30
    }
31
}
32