SymfonyUserUrlGeneratorSpec::it_generates()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 10
rs 9.4285
cc 1
eloc 7
nc 1
nop 1
1
<?php
2
3
/*
4
 * This file is part of the BenGorUser package.
5
 *
6
 * (c) Beñat Espiña <[email protected]>
7
 * (c) Gorka Laucirica <[email protected]>
8
 *
9
 * For the full copyright and license information, please view the LICENSE
10
 * file that was distributed with this source code.
11
 */
12
13
namespace spec\BenGorUser\SymfonyRoutingBridge\Infrastructure\Routing;
14
15
use BenGorUser\SymfonyRoutingBridge\Infrastructure\Routing\SymfonyUserUrlGenerator;
16
use BenGorUser\User\Domain\Model\UserUrlGenerator;
17
use PhpSpec\ObjectBehavior;
18
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
19
20
/**
21
 * Spec file of SymfonyUserUrlGenerator class.
22
 *
23
 * @author Beñat Espiña <[email protected]>
24
 */
25
class SymfonyUserUrlGeneratorSpec extends ObjectBehavior
26
{
27
    function let(UrlGeneratorInterface $urlGenerator)
28
    {
29
        $this->beConstructedWith($urlGenerator, 'bengor_user_user_homepage');
30
    }
31
32
    function it_is_initializable()
33
    {
34
        $this->shouldHaveType(SymfonyUserUrlGenerator::class);
35
    }
36
37
    function it_implements_user_url_generator()
38
    {
39
        $this->shouldImplement(UserUrlGenerator::class);
40
    }
41
42
    function it_generates(UrlGeneratorInterface $urlGenerator)
43
    {
44
        $urlGenerator->generate(
45
            'bengor_user_user_homepage',
46
            ['token' => 'the-token'],
47
            UrlGeneratorInterface::ABSOLUTE_URL
48
        )->shouldBeCalled()->willReturn('/');
49
50
        $this->generate('the-token')->shouldReturn('/');
51
    }
52
}
53