[BUGFIX] Fix typo3 unit tests
authorWouter Wolters <typo3@wouterwolters.nl>
Sat, 25 Aug 2012 16:16:02 +0000 (18:16 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Sat, 25 Aug 2012 17:02:26 +0000 (19:02 +0200)
Change-Id: If0c65781ea1c7e7979b22039cbc516040fa994e6
Resolves: #40201
Related: #40095
Releases: 6.0
Reviewed-on: http://review.typo3.org/14087
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
tests/Unit/t3lib/cache/frontend/class.t3lib_cache_frontend_variablefrontendTest.php
tests/Unit/t3lib/class.t3lib_cacheHashTest.php
tests/Unit/t3lib/class.t3lib_divTest.php
tests/Unit/t3lib/matchcondition/class.t3lib_matchcondition_backendTest.php
tests/Unit/t3lib/matchcondition/class.t3lib_matchcondition_frontendTest.php

index cbbe232..1e78021 100644 (file)
@@ -175,10 +175,10 @@ class t3lib_cache_frontend_VariableFrontendTest extends tx_phpunit_testcase {
 
        /**
         * @test
-        * @expectedException InvalidArgumentException
+        * @expectedException \InvalidArgumentException
         */
        public function getByTagRejectsInvalidTags() {
-               $backend = $this->getMock('TYPO3\\CMS\\Core\\Cache\\Backend\\Backend', array(), array(), '', FALSE);
+               $backend = $this->getMock('TYPO3\\CMS\\Core\\Cache\\Backend\\BackendInterface', array(), array(), '', FALSE);
                $backend->expects($this->never())->method('getByTag');
 
                $cache = new TYPO3\CMS\Core\Cache\Frontend\VariableFrontend('VariableFrontend', $backend);
index e72df7e..194dc75 100644 (file)
@@ -44,7 +44,7 @@ class t3lib_cacheHashTest extends tx_phpunit_testcase {
                $this->confCache = array(
                        'encryptionKey' => $GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey']
                );
-               $GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'] = 'TYPO3\\CMS\\Core\\Cache\\CacheHashTest';
+               $GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'] = 't3lib_cacheHashTest';
                $this->fixture = $this->getMock('TYPO3\\CMS\\Frontend\\Page\\CacheHashCalculator', array('foo'));
                $this->fixture->setConfiguration(array(
                        'excludedParameters' => array('exclude1', 'exclude2'),
@@ -77,11 +77,11 @@ class t3lib_cacheHashTest extends tx_phpunit_testcase {
                return array(
                        'Empty parameters should not return a hash' => array(array(), ''),
                        'Trivial key value combination should generate hash' => array(
-                               array('encryptionKey' => 'TYPO3\\CMS\\Core\\Cache\\CacheHashTest', 'key' => 'value'),
+                               array('encryptionKey' => 't3lib_cacheHashTest', 'key' => 'value'),
                                '5cfdcf826275558b3613dd51714a0a17'
                        ),
                        'Multiple parameters should generate hash' => array(
-                               array('a' => 'v', 'b' => 'v', 'encryptionKey' => 'TYPO3\\CMS\\Core\\Cache\\CacheHashTest'),
+                               array('a' => 'v', 'b' => 'v', 'encryptionKey' => 't3lib_cacheHashTest'),
                                '0f40b089cdad149aea99e9bf4badaa93'
                        )
                );
index 6dd50e2..d28c544 100644 (file)
@@ -307,7 +307,7 @@ class t3lib_divTest extends tx_phpunit_testcase {
                        '/32 subnet (match only name)' => array('127.0.0.1', '127.0.0.1/32'),
                        '/30 subnet' => array('10.10.3.1', '10.10.3.3/30'),
                        'host with wildcard in list with IPv4/IPv6 addresses' => array('192.168.1.1', '127.0.0.1, 1234:5678::/126, 192.168.*'),
-                       'host in list with IPv4/IPv6 addresses' => array('192.168.1.1', '::1, 1234:5678::/126, 192.168.1.1')
+                       'host in list with IPv4/IPv6 addresses' => array('192.168.1.1', '::1, 1234:5678::/126, 192.168.1.1'),
                );
        }
 
@@ -410,11 +410,11 @@ class t3lib_divTest extends tx_phpunit_testcase {
         */
        static public function IPv6Hex2BinDataProviderCorrect() {
                return array(
-                       'empty 1' => array('::', str_pad('', 16, '\0')),
-                       'empty 2, already normalized' => array('0000:0000:0000:0000:0000:0000:0000:0000', str_pad('', 16, '\0')),
-                       'already normalized' => array('0102:0304:0000:0000:0000:0000:0506:0078', ('\ 1\ 2\ 3\ 4' . str_pad('', 8, '\0')) . '\ 5\ 6\0x'),
-                       'expansion in middle 1' => array('1::2', ('\0\ 1' . str_pad('', 12, '\0')) . '\0\ 2'),
-                       'expansion in middle 2' => array('beef::fefa', ('��' . str_pad('', 12, '\0')) . '��')
+                       'empty 1' => array('::', str_pad('', 16, "\x00")),
+                       'empty 2, already normalized' => array('0000:0000:0000:0000:0000:0000:0000:0000', str_pad('', 16, "\x00")),
+                       'already normalized' => array('0102:0304:0000:0000:0000:0000:0506:0078', "\x01\x02\x03\x04" . str_pad('', 8, "\x00") . "\x05\x06\x00\x78"),
+                       'expansion in middle 1' => array('1::2', "\x00\x01" . str_pad('', 12, "\x00") . "\x00\x02"),
+                       'expansion in middle 2' => array('beef::fefa', "\xbe\xef" . str_pad('', 12, "\x00") . "\xfe\xfa"),
                );
        }
 
@@ -436,12 +436,12 @@ class t3lib_divTest extends tx_phpunit_testcase {
         */
        static public function IPv6Bin2HexDataProviderCorrect() {
                return array(
-                       'empty' => array(str_pad('', 16, '\0'), '::'),
-                       'non-empty front' => array('\ 1' . str_pad('', 15, '\0'), '100::'),
-                       'non-empty back' => array(str_pad('', 15, '\0') . '\ 1', '::1'),
-                       'normalized' => array(('\ 1\ 2\ 3\ 4' . str_pad('', 8, '\0')) . '\ 5\ 6\0x', '102:304::506:78'),
-                       'expansion in middle 1' => array(('\0\ 1' . str_pad('', 12, '\0')) . '\0\ 2', '1::2'),
-                       'expansion in middle 2' => array(('��' . str_pad('', 12, '\0')) . '��', 'beef::fefa')
+                       'empty' => array(str_pad('', 16, "\x00"), '::'),
+                       'non-empty front' => array("\x01" . str_pad('', 15, "\x00"), '100::'),
+                       'non-empty back' => array(str_pad('', 15, "\x00") . "\x01", '::1'),
+                       'normalized' => array("\x01\x02\x03\x04" . str_pad('', 8, "\x00") . "\x05\x06\x00\x78", '102:304::506:78'),
+                       'expansion in middle 1' => array("\x00\x01" . str_pad('', 12, "\x00") . "\x00\x02", '1::2'),
+                       'expansion in middle 2' => array("\xbe\xef" . str_pad('', 12, "\x00") . "\xfe\xfa", 'beef::fefa'),
                );
        }
 
@@ -3609,7 +3609,7 @@ class t3lib_divTest extends tx_phpunit_testcase {
         * @test
         */
        public function validPathStrWorksWithUnicodeFileNames() {
-               $this->assertTrue(\TYPO3\CMS\Core\Utility\GeneralUtility::validPathStr('fileadmin/TYPO3\\CMS\\Backend\\Template\\DocumentTemplates/Ссылка (fce).xml'));
+               $this->assertTrue(\TYPO3\CMS\Core\Utility\GeneralUtility::validPathStr('fileadmin/templates/Ссылка (fce).xml'));
        }
 
        /**
index 0da7680..1c17cc2 100644 (file)
@@ -256,8 +256,8 @@ class t3lib_matchCondition_backendTest extends tx_phpunit_testcase {
         */
        public function languageConditionMatchesSingleLanguageExpression() {
                $_SERVER['HTTP_ACCEPT_LANGUAGE'] = 'de-de,de;q=0.8,en-us;q=0.5,en;q=0.3';
-               $this->assertTrue($this->matchCondition->match('[TYPO3\\CMS\\Lang\\LanguageService = *de*]'));
-               $this->assertTrue($this->matchCondition->match('[TYPO3\\CMS\\Lang\\LanguageService = *de-de*]'));
+               $this->assertTrue($this->matchCondition->match('[language = *de*]'));
+               $this->assertTrue($this->matchCondition->match('[language = *de-de*]'));
        }
 
        /**
@@ -267,8 +267,8 @@ class t3lib_matchCondition_backendTest extends tx_phpunit_testcase {
         */
        public function languageConditionMatchesMultipleLanguagesExpression() {
                $_SERVER['HTTP_ACCEPT_LANGUAGE'] = 'de-de,de;q=0.8,en-us;q=0.5,en;q=0.3';
-               $this->assertTrue($this->matchCondition->match('[TYPO3\\CMS\\Lang\\LanguageService = *en*,*de*]'));
-               $this->assertTrue($this->matchCondition->match('[TYPO3\\CMS\\Lang\\LanguageService = *en-us*,*de-de*]'));
+               $this->assertTrue($this->matchCondition->match('[language = *en*,*de*]'));
+               $this->assertTrue($this->matchCondition->match('[language = *en-us*,*de-de*]'));
        }
 
        /**
@@ -279,7 +279,7 @@ class t3lib_matchCondition_backendTest extends tx_phpunit_testcase {
        public function languageConditionMatchesCompleteLanguagesExpression() {
                $this->markTestSkipped('This comparison seems to be incomplete in t3lib_matchCondition.');
                $_SERVER['HTTP_ACCEPT_LANGUAGE'] = 'de-de,de;q=0.8,en-us;q=0.5,en;q=0.3';
-               $this->assertTrue($this->matchCondition->match('[TYPO3\\CMS\\Lang\\LanguageService = de-de,de;q=0.8]'));
+               $this->assertTrue($this->matchCondition->match('[language = de-de,de;q=0.8]'));
        }
 
        /**
index 5111e33..6a3d25b 100644 (file)
@@ -240,8 +240,8 @@ class t3lib_matchCondition_frontendTest extends tx_phpunit_testcase {
         */
        public function languageConditionMatchesSingleLanguageExpression() {
                $_SERVER['HTTP_ACCEPT_LANGUAGE'] = 'de-de,de;q=0.8,en-us;q=0.5,en;q=0.3';
-               $this->assertTrue($this->matchCondition->match('[TYPO3\\CMS\\Lang\\LanguageService = *de*]'));
-               $this->assertTrue($this->matchCondition->match('[TYPO3\\CMS\\Lang\\LanguageService = *de-de*]'));
+               $this->assertTrue($this->matchCondition->match('[language = *de*]'));
+               $this->assertTrue($this->matchCondition->match('[language = *de-de*]'));
        }
 
        /**
@@ -251,8 +251,8 @@ class t3lib_matchCondition_frontendTest extends tx_phpunit_testcase {
         */
        public function languageConditionMatchesMultipleLanguagesExpression() {
                $_SERVER['HTTP_ACCEPT_LANGUAGE'] = 'de-de,de;q=0.8,en-us;q=0.5,en;q=0.3';
-               $this->assertTrue($this->matchCondition->match('[TYPO3\\CMS\\Lang\\LanguageService = *en*,*de*]'));
-               $this->assertTrue($this->matchCondition->match('[TYPO3\\CMS\\Lang\\LanguageService = *en-us*,*de-de*]'));
+               $this->assertTrue($this->matchCondition->match('[language = *en*,*de*]'));
+               $this->assertTrue($this->matchCondition->match('[language = *en-us*,*de-de*]'));
        }
 
        /**
@@ -263,7 +263,7 @@ class t3lib_matchCondition_frontendTest extends tx_phpunit_testcase {
        public function languageConditionMatchesCompleteLanguagesExpression() {
                $this->markTestSkipped('This comparison seems to be incomplete in t3lib_matchCondition.');
                $_SERVER['HTTP_ACCEPT_LANGUAGE'] = 'de-de,de;q=0.8,en-us;q=0.5,en;q=0.3';
-               $this->assertTrue($this->matchCondition->match('[TYPO3\\CMS\\Lang\\LanguageService = de-de,de;q=0.8]'));
+               $this->assertTrue($this->matchCondition->match('[language = de-de,de;q=0.8]'));
        }
 
        /**