[TASK] TypoScript: Condition for Windows 8 83/24783/5
authorStefan Neufeind <typo3.neufeind@speedpartner.de>
Tue, 15 Oct 2013 08:05:08 +0000 (10:05 +0200)
committerStefan Neufeind <typo3.neufeind@speedpartner.de>
Tue, 22 Oct 2013 08:46:49 +0000 (10:46 +0200)
Reports itself as "Windows NT 6.2"
or "Windows NT 6.3" in user-agent.

Change-Id: Ibdc4b749d6009ca36a6c8c5c621d81838888f6cf
Resolves: #51813
Documentation: #51814
Releases: 6.2
Reviewed-on: https://review.typo3.org/24783
Reviewed-by: Stefan Neufeind
Tested-by: Stefan Neufeind
typo3/sysext/core/Classes/Utility/ClientUtility.php
typo3/sysext/core/Tests/Unit/Utility/ClientUtilityTest.php

index 3ba3f02..ae64bf6 100644 (file)
@@ -117,7 +117,10 @@ class ClientUtility {
                $browserInfo['all_systems'] = array();
                if (strstr($userAgent, 'Win')) {
                        // Windows
-                       if (strstr($userAgent, 'Windows NT 6.1')) {
+                       if (strstr($userAgent, 'Windows NT 6.2') || strstr($userAgent, 'Windows NT 6.3')) {
+                               $browserInfo['all_systems'][] = 'win8';
+                               $browserInfo['all_systems'][] = 'winNT';
+                       } elseif (strstr($userAgent, 'Windows NT 6.1')) {
                                $browserInfo['all_systems'][] = 'win7';
                                $browserInfo['all_systems'][] = 'winNT';
                        } elseif (strstr($userAgent, 'Windows NT 6.0')) {
@@ -224,4 +227,4 @@ class ClientUtility {
                return $deviceType;
        }
 
-}
+}
\ No newline at end of file
index e74d96d..ac8879b 100644 (file)
@@ -190,6 +190,25 @@ class ClientUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                $this->assertEquals('1.9.2.3', $infoArray['all']['gecko']);
        }
 
+       /**
+        * @test
+        */
+       public function getBrowserInfoReturnsCorrectSystemValueForUserAgentStringOfWindows8() {
+               $userAgentString = 'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Trident/6.0)';
+               $infoArray = \TYPO3\CMS\Core\Utility\ClientUtility::getBrowserInfo($userAgentString);
+               $this->assertContains('win8', $infoArray['all_systems']);
+       }
+
+
+       /**
+        * @test
+        */
+       public function getBrowserInfoReturnsCorrectSystemValueForUserAgentStringOfWindows8rev1() {
+               $userAgentString = 'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.3; Trident/6.0)';
+               $infoArray = \TYPO3\CMS\Core\Utility\ClientUtility::getBrowserInfo($userAgentString);
+               $this->assertContains('win8', $infoArray['all_systems']);
+       }
+
        /**
         * @test
         */
@@ -415,4 +434,4 @@ class ClientUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                $this->assertSame('konqueror', $infoArray['browser']);
        }
 
-}
+}
\ No newline at end of file