summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2014-01-07 11:06:20 -0800
committerThomas Müller <thomas.mueller@tmit.eu>2014-01-07 11:06:20 -0800
commit2d5427efa99e910abe46f2c6ab567b2392169f26 (patch)
treecf34ecdace87f8a4d015eaa8920ba89c6bd7394c /tests
parentf2fbfbc665b90dbd23c0a353b07fad7c67176a6a (diff)
parent09bd5bd517fee80e8b44b7645b51a8ba482a4d7c (diff)
downloadnextcloud-server-2d5427efa99e910abe46f2c6ab567b2392169f26.tar.gz
nextcloud-server-2d5427efa99e910abe46f2c6ab567b2392169f26.zip
Merge pull request #6290 from owncloud/files-androidcontentdisposition
Files androidcontentdisposition
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/request.php50
1 files changed, 50 insertions, 0 deletions
diff --git a/tests/lib/request.php b/tests/lib/request.php
index 090cebc9231..c6401a57144 100644
--- a/tests/lib/request.php
+++ b/tests/lib/request.php
@@ -70,4 +70,54 @@ class Test_Request extends PHPUnit_Framework_TestCase {
array('/oc/core1', '/oc/core/index.php'),
);
}
+
+ /**
+ * @dataProvider userAgentProvider
+ */
+ public function testUserAgent($testAgent, $userAgent, $matches) {
+ $_SERVER['HTTP_USER_AGENT'] = $testAgent;
+ $this->assertEquals($matches, OC_Request::isUserAgent($userAgent));
+ }
+
+ function userAgentProvider() {
+ return array(
+ array(
+ 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0)',
+ OC_Request::USER_AGENT_IE,
+ true
+ ),
+ array(
+ 'Mozilla/5.0 (X11; Linux i686; rv:24.0) Gecko/20100101 Firefox/24.0',
+ OC_Request::USER_AGENT_IE,
+ false
+ ),
+ array(
+ 'Mozilla/5.0 (Linux; Android 4.4; Nexus 4 Build/KRT16S) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.59 Mobile Safari/537.36',
+ OC_Request::USER_AGENT_ANDROID_MOBILE_CHROME,
+ true
+ ),
+ array(
+ 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0)',
+ OC_Request::USER_AGENT_ANDROID_MOBILE_CHROME,
+ false
+ ),
+ // test two values
+ array(
+ 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0)',
+ array(
+ OC_Request::USER_AGENT_IE,
+ OC_Request::USER_AGENT_ANDROID_MOBILE_CHROME,
+ ),
+ true
+ ),
+ array(
+ 'Mozilla/5.0 (Linux; Android 4.4; Nexus 4 Build/KRT16S) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.59 Mobile Safari/537.36',
+ array(
+ OC_Request::USER_AGENT_IE,
+ OC_Request::USER_AGENT_ANDROID_MOBILE_CHROME,
+ ),
+ true
+ ),
+ );
+ }
}