Skip to content

Commit 47cb289

Browse files
committed
Added get url tests
1 parent 39c9eb3 commit 47cb289

1 file changed

Lines changed: 33 additions & 0 deletions

File tree

test/Unit/Network/RequestTest.php

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,4 +114,37 @@ public function testPost()
114114

115115
$this->assertSame('bar', $request->post('foo'));
116116
}
117+
118+
/**
119+
* @covers OpCacheGUI\Network\Request::__construct
120+
* @covers OpCacheGUI\Network\Request::getUrl
121+
*/
122+
public function testGetUrlSslEnabled()
123+
{
124+
$request = new Request([], [], ['HTTPS' => 'on', 'HTTP_HOST' => 'foo.com', 'REQUEST_URI' => '/bar']);
125+
126+
$this->assertSame('https://foo.com/bar', $request->getUrl());
127+
}
128+
129+
/**
130+
* @covers OpCacheGUI\Network\Request::__construct
131+
* @covers OpCacheGUI\Network\Request::getUrl
132+
*/
133+
public function testGetUrlSslDisabled()
134+
{
135+
$request = new Request([], [], ['HTTP_HOST' => 'foo.com', 'REQUEST_URI' => '/bar']);
136+
137+
$this->assertSame('http://foo.com/bar', $request->getUrl());
138+
}
139+
140+
/**
141+
* @covers OpCacheGUI\Network\Request::__construct
142+
* @covers OpCacheGUI\Network\Request::getUrl
143+
*/
144+
public function testGetUrlSslDisabledIIS()
145+
{
146+
$request = new Request([], [], ['HTTPS' => 'off', 'HTTP_HOST' => 'foo.com', 'REQUEST_URI' => '/bar']);
147+
148+
$this->assertSame('http://foo.com/bar', $request->getUrl());
149+
}
117150
}

0 commit comments

Comments
 (0)