Passed
Push — master ( 822c3c...2043a4 )
by Gabriel
02:53
created

UrlTransformerTest::test_transform()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 15
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 8
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 15
rs 10
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
            'SERVER_NAME' => 'current.domain.com'
20
        ]
21
        );
22
        $section = new Section(['subdomain' => 'new']);
23
24
        $url = 'https://current.domain.com/index?redirect=https://current.domain.com';
25
        $transformer = UrlTransformer::from($request);
26
27
        self::assertSame(
28
            'https://new.domain.com/index?redirect=https://current.domain.com',
29
            $transformer->transform($url, $section)
30
        );
31
    }
32
}