summaryrefslogtreecommitdiffstats
path: root/tests/lib
diff options
context:
space:
mode:
Diffstat (limited to 'tests/lib')
-rw-r--r--tests/lib/appframework/controller/ControllerTest.php3
-rw-r--r--tests/lib/request.php17
2 files changed, 19 insertions, 1 deletions
diff --git a/tests/lib/appframework/controller/ControllerTest.php b/tests/lib/appframework/controller/ControllerTest.php
index d186651dc23..18d47d00f6b 100644
--- a/tests/lib/appframework/controller/ControllerTest.php
+++ b/tests/lib/appframework/controller/ControllerTest.php
@@ -173,7 +173,8 @@ class ControllerTest extends \Test\TestCase {
public function testFormatDataResponseJSON() {
$expectedHeaders = array(
'test' => 'something',
- 'Cache-Control' => 'no-cache, must-revalidate'
+ 'Cache-Control' => 'no-cache, must-revalidate',
+ 'Content-Type' => 'application/json; charset=utf-8'
);
$response = $this->controller->customDataResponse(array('hi'));
diff --git a/tests/lib/request.php b/tests/lib/request.php
index 254048723e7..ea3722b90a6 100644
--- a/tests/lib/request.php
+++ b/tests/lib/request.php
@@ -228,6 +228,23 @@ class Test_Request extends \Test\TestCase {
OC_Config::deleteKey('overwritehost');
}
+ public function hostWithPortProvider() {
+ return array(
+ array('localhost:500', 'localhost'),
+ array('foo.com', 'foo.com'),
+ array('[1fff:0:a88:85a3::ac1f]:801', '[1fff:0:a88:85a3::ac1f]'),
+ array('[1fff:0:a88:85a3::ac1f]', '[1fff:0:a88:85a3::ac1f]')
+ );
+ }
+
+ /**
+ * @dataProvider hostWithPortProvider
+ */
+ public function testGetDomainWithoutPort($hostWithPort, $host) {
+ $this->assertEquals($host, OC_Request::getDomainWithoutPort($hostWithPort));
+
+ }
+
/**
* @dataProvider trustedDomainDataProvider
*/