@@ 59-73 (lines=15) @@ | ||
56 | $this->assertEquals('https://foo.bar/baz?foo=123', $currentUri); |
|
57 | } |
|
58 | ||
59 | public function testProperlyGeneratesUrlFromProxy() |
|
60 | { |
|
61 | $_SERVER = [ |
|
62 | 'HTTP_X_FORWARDED_PORT' => '80', |
|
63 | 'HTTP_X_FORWARDED_PROTO' => 'http', |
|
64 | 'HTTP_HOST' => 'foo.bar', |
|
65 | 'SERVER_PORT' => '80', |
|
66 | 'REQUEST_URI' => '/baz?foo=123', |
|
67 | ]; |
|
68 | ||
69 | $urlHandler = new UrlDetectionHandler(); |
|
70 | $currentUri = $urlHandler->getCurrentUrl(); |
|
71 | ||
72 | $this->assertEquals('http://foo.bar/baz?foo=123', $currentUri); |
|
73 | } |
|
74 | ||
75 | public function testProperlyGeneratesSecureUrlFromProxy() |
|
76 | { |
|
@@ 75-89 (lines=15) @@ | ||
72 | $this->assertEquals('http://foo.bar/baz?foo=123', $currentUri); |
|
73 | } |
|
74 | ||
75 | public function testProperlyGeneratesSecureUrlFromProxy() |
|
76 | { |
|
77 | $_SERVER = [ |
|
78 | 'HTTP_X_FORWARDED_PORT' => '443', |
|
79 | 'HTTP_X_FORWARDED_PROTO' => 'https', |
|
80 | 'HTTP_HOST' => 'foo.bar', |
|
81 | 'SERVER_PORT' => '80', |
|
82 | 'REQUEST_URI' => '/baz?foo=123', |
|
83 | ]; |
|
84 | ||
85 | $urlHandler = new UrlDetectionHandler(); |
|
86 | $currentUri = $urlHandler->getCurrentUrl(); |
|
87 | ||
88 | $this->assertEquals('https://foo.bar/baz?foo=123', $currentUri); |
|
89 | } |
|
90 | ||
91 | public function testProperlyGeneratesUrlWithCustomPort() |
|
92 | { |
|
@@ 105-118 (lines=14) @@ | ||
102 | $this->assertEquals('http://foo.bar:1337/foo.php', $currentUri); |
|
103 | } |
|
104 | ||
105 | public function testProperlyGeneratesSecureUrlWithCustomPort() |
|
106 | { |
|
107 | $_SERVER = [ |
|
108 | 'HTTP_HOST' => 'foo.bar', |
|
109 | 'SERVER_PORT' => '1337', |
|
110 | 'REQUEST_URI' => '/foo.php', |
|
111 | 'HTTPS' => 'On', |
|
112 | ]; |
|
113 | ||
114 | $urlHandler = new UrlDetectionHandler(); |
|
115 | $currentUri = $urlHandler->getCurrentUrl(); |
|
116 | ||
117 | $this->assertEquals('https://foo.bar:1337/foo.php', $currentUri); |
|
118 | } |
|
119 | ||
120 | public function testProperlyGeneratesUrlWithCustomPortFromProxy() |
|
121 | { |
|
@@ 120-134 (lines=15) @@ | ||
117 | $this->assertEquals('https://foo.bar:1337/foo.php', $currentUri); |
|
118 | } |
|
119 | ||
120 | public function testProperlyGeneratesUrlWithCustomPortFromProxy() |
|
121 | { |
|
122 | $_SERVER = [ |
|
123 | 'HTTP_X_FORWARDED_PORT' => '8888', |
|
124 | 'HTTP_X_FORWARDED_PROTO' => 'http', |
|
125 | 'HTTP_HOST' => 'foo.bar', |
|
126 | 'SERVER_PORT' => '80', |
|
127 | 'REQUEST_URI' => '/foo.php', |
|
128 | ]; |
|
129 | ||
130 | $urlHandler = new UrlDetectionHandler(); |
|
131 | $currentUri = $urlHandler->getCurrentUrl(); |
|
132 | ||
133 | $this->assertEquals('http://foo.bar:8888/foo.php', $currentUri); |
|
134 | } |
|
135 | } |
|
136 |