Completed
Push273326...4e90ef
passed — Build
created

SymfonyUrlGeneratorTest::test()   B

↳ Parent: SymfonyUrlGeneratorTest

Complexity

Conditions 2
Paths 2

Duplication

Lines 0
Ratio 0 %

Size

Total Lines 24
Code Lines 15

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 24
rs 8.9713
cc 2
eloc 15
nc 2
nop 0
1
<?php
2
3
namespace Hateoas\Tests\UrlGenerator;
4
5
use Hateoas\Tests\TestCase;
6
use Hateoas\UrlGenerator\SymfonyUrlGenerator;
7
8
class SymfonyUrlGeneratorTest extends TestCase
9
{
10
    public function test()
11
    {
12
        $name           = 'user_get';
13
        $parameters     = array('id' => 42);
14
        $absolute       = true;
15
        $expectedResult = '/users/42';
16
17
        if (\Symfony\Component\Routing\Generator\UrlGeneratorInterface::ABSOLUTE_PATH === 1) {
18
            $absolute = \Symfony\Component\Routing\Generator\UrlGeneratorInterface::ABSOLUTE_URL;
19
        }
20
21
        $symfonyUrlGeneratorProphecy = $this->prophesize('Symfony\Component\Routing\Generator\UrlGeneratorInterface');
22
        $symfonyUrlGeneratorProphecy
23
            ->generate($name, $parameters, $absolute)
24
            ->willReturn($expectedResult)
25
        ;
26
27
        $urlGenerator = new SymfonyUrlGenerator($symfonyUrlGeneratorProphecy->reveal());
28
29
        $this->assertSame(
30
            $expectedResult,
31
            $urlGenerator->generate($name, $parameters, $absolute)
32
        );
33
    }
34
}
35