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