[TASK] Cleanup Unit Tests
authorHelmut Hummel <helmut.hummel@typo3.org>
Wed, 12 Sep 2012 22:14:10 +0000 (00:14 +0200)
committerHelmut Hummel <helmut.hummel@typo3.org>
Wed, 12 Sep 2012 22:18:02 +0000 (00:18 +0200)
* Skip the IPV6 Test that always fails on darwin/ OSX OS
* Remove the potentially skipped tests concerning t3lib_diff
  since this class is still in use

Change-Id: Iab26c428ff7cf8a8b447d536d820821ed000a8fd
Resolves: #40879
Releases: 6.0
Reviewed-on: http://review.typo3.org/14564
Reviewed-by: Wouter Wolters
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
Reviewed-by: Helmut Hummel
Tested-by: Helmut Hummel
typo3/sysext/core/Tests/Unit/Utility/GeneralUtilityTest.php
typo3/sysext/frontend/Tests/Unit/Page/CacheHashCalculatorTest.php

index 7538afe..b46a9b3 100644 (file)
@@ -458,9 +458,6 @@ class GeneralUtilityTest extends \tx_phpunit_testcase {
         * @dataProvider IPv6Bin2HexDataProviderCorrect
         */
        public function IPv6Bin2HexCorrectlyConvertsAddresses($binary, $hex) {
-               if (!class_exists('t3lib_diff')) {
-                       $this->markTestSkipped('The current version of phpunit relies on t3lib_diff which is removed in 6.0 and thus this test fails. Move t3lib_diff to phpunit and reenable this test.');
-               }
                $this->assertEquals(\TYPO3\CMS\Core\Utility\GeneralUtility::IPv6Bin2Hex($binary), $hex);
        }
 
@@ -476,7 +473,6 @@ class GeneralUtilityTest extends \tx_phpunit_testcase {
                return array(
                        'empty' => array('::', '0000:0000:0000:0000:0000:0000:0000:0000'),
                        'localhost' => array('::1', '0000:0000:0000:0000:0000:0000:0000:0001'),
-                       'some address on right side' => array('::f0f', '0000:0000:0000:0000:0000:0000:0000:0f0f'),
                        'expansion in middle 1' => array('1::2', '0001:0000:0000:0000:0000:0000:0000:0002'),
                        'expansion in middle 2' => array('1:2::3', '0001:0002:0000:0000:0000:0000:0000:0003'),
                        'expansion in middle 3' => array('1::2:3', '0001:0000:0000:0000:0000:0000:0002:0003'),
@@ -489,7 +485,7 @@ class GeneralUtilityTest extends \tx_phpunit_testcase {
         * @dataProvider normalizeCompressIPv6DataProviderCorrect
         */
        public function normalizeIPv6CorrectlyNormalizesAddresses($compressed, $normalized) {
-               $this->assertEquals(\TYPO3\CMS\Core\Utility\GeneralUtility::normalizeIPv6($compressed), $normalized);
+               $this->assertEquals($normalized, \TYPO3\CMS\Core\Utility\GeneralUtility::normalizeIPv6($compressed));
        }
 
        /**
@@ -497,10 +493,17 @@ class GeneralUtilityTest extends \tx_phpunit_testcase {
         * @dataProvider normalizeCompressIPv6DataProviderCorrect
         */
        public function compressIPv6CorrectlyCompressesAdresses($compressed, $normalized) {
-               if (!class_exists('t3lib_diff')) {
-                       $this->markTestSkipped('The current version of phpunit relies on t3lib_diff which is removed in 6.0 and thus this test fails. Move t3lib_diff to phpunit and reenable this test.');
+               $this->assertEquals($compressed, \TYPO3\CMS\Core\Utility\GeneralUtility::compressIPv6($normalized));
+       }
+
+       /**
+        * @test
+        */
+       public function compressIPv6CorrectlyCompressesAdressWithSomeAddressOnRightSide() {
+               if (strtolower(PHP_OS) === 'darwin') {
+                       $this->markTestSkipped('This test does not work on OSX / Darwin OS.');
                }
-               $this->assertEquals(\TYPO3\CMS\Core\Utility\GeneralUtility::compressIPv6($normalized), $compressed);
+               $this->assertEquals('::f0f', \TYPO3\CMS\Core\Utility\GeneralUtility::compressIPv6('0000:0000:0000:0000:0000:0000:0000:0f0f'));
        }
 
        ///////////////////////////////
index 753836c..ddc1d88 100644 (file)
@@ -67,9 +67,6 @@ class CacheHashCalculatorTest extends \tx_phpunit_testcase {
         * @test
         */
        public function cacheHashCalculationWorks($params, $expected) {
-               if (!class_exists('t3lib_diff')) {
-                       $this->markTestSkipped('The current version of phpunit relies on t3lib_diff which is removed in 6.0 and thus this test fails. Move t3lib_diff to phpunit and reenable this test.');
-               }
                $this->assertEquals($expected, $this->fixture->calculateCacheHash($params));
        }
 
@@ -139,9 +136,6 @@ class CacheHashCalculatorTest extends \tx_phpunit_testcase {
         * @test
         */
        public function canGenerateForParameters($params, $expected) {
-               if (!class_exists('t3lib_diff')) {
-                       $this->markTestSkipped('The current version of phpunit relies on t3lib_diff which is removed in 6.0 and thus this test fails. Move t3lib_diff to phpunit and reenable this test.');
-               }
                $this->assertEquals($expected, $this->fixture->generateForParameters($params));
        }
 
@@ -193,9 +187,6 @@ class CacheHashCalculatorTest extends \tx_phpunit_testcase {
         * @test
         */
        public function canWhitelistParameters($params, $expected) {
-               if (!class_exists('t3lib_diff')) {
-                       $this->markTestSkipped('The current version of phpunit relies on t3lib_diff which is removed in 6.0 and thus this test fails. Move t3lib_diff to phpunit and reenable this test.');
-               }
                $method = new \ReflectionMethod('TYPO3\\CMS\\Frontend\\Page\\CacheHashCalculator', 'setCachedParametersWhiteList');
                $method->setAccessible(TRUE);
                $method->invoke($this->fixture, array('whitep1', 'whitep2'));