UrlTransformerTest::test_transform()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 20
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 1 Features 0
Metric Value
cc 1
eloc 8
nc 1
nop 0
dl 0
loc 20
rs 10
c 2
b 1
f 0
1
<?php
2
3
namespace Nip\Mvc\Tests\Sections\UrlTransformer;
4
5
use Nip\Http\Request;
6
use Nip\Mvc\Sections\Section;
7
use Nip\Mvc\Sections\UrlTransformer\UrlTransformer;
8
9
/**
10
 * Class UrlTransformerTest
11
 * @package Nip\Mvc\Tests\Sections\UrlTransformer
12
 */
13
class UrlTransformerTest extends \Nip\Mvc\Tests\AbstractTest
14
{
15
    public function test_transform()
16
    {
17
        $request = new Request(
18
            [],
19
            [],
20
            [],
21
            [],
22
            [],
23
            [
24
            'SERVER_NAME' => 'current.domain.com'
25
        ]
26
        );
27
        $section = new Section(['subdomain' => 'new']);
28
29
        $url = 'https://current.domain.com/index?redirect=https://current.domain.com';
30
        $transformer = UrlTransformer::from($request);
31
32
        self::assertSame(
33
            'https://new.domain.com/index?redirect=https://current.domain.com',
34
            $transformer->transform($url, $section)
35
        );
36
    }
37
}
38