[TASK] Better mocking of $GLOBALS['LANG'] 34/25234/3
authorChristian Kuhn <lolli@schwarzbu.ch>
Sat, 9 Nov 2013 15:43:06 +0000 (16:43 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Sat, 9 Nov 2013 17:27:11 +0000 (18:27 +0100)
To further remove dependencies in unit tests, some tests are
adapted to correctly mock $GLOBALS['LANG']. The PageRenderer
tests still need adaptions in a separate patch, so the test
bootstrap still initializes the language handling for now.

Change-Id: I5d6a8a0a0fe738fef676fbc637a02fe9700ccee3
Resolves: #53476
Related: #51436
Releases: 6.2
Reviewed-on: https://review.typo3.org/25234
Reviewed-by: Anja Leichsenring
Tested-by: Anja Leichsenring
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
35 files changed:
typo3/sysext/backend/Classes/Module/ModuleController.php
typo3/sysext/backend/Tests/Unit/Configuration/TypoScript/ConditionMatching/ConditionMatcherTest.php
typo3/sysext/backend/Tests/Unit/Module/ModuleControllerTest.php
typo3/sysext/backend/Tests/Unit/Utility/BackendUtilityTest.php
typo3/sysext/core/Classes/FormProtection/BackendFormProtection.php
typo3/sysext/core/Classes/Page/PageRenderer.php
typo3/sysext/core/Tests/Unit/FormProtection/BackendFormProtectionTest.php
typo3/sysext/core/Tests/Unit/Resource/FileTest.php
typo3/sysext/extensionmanager/Classes/Report/ExtensionStatus.php
typo3/sysext/extensionmanager/Tests/Unit/Report/ExtensionStatusTest.php
typo3/sysext/form/Tests/Unit/Validation/AlphabeticValidatorTest.php
typo3/sysext/form/Tests/Unit/Validation/AlphanumericValidatorTest.php
typo3/sysext/form/Tests/Unit/Validation/BetweenValidatorTest.php
typo3/sysext/form/Tests/Unit/Validation/DateValidatorTest.php
typo3/sysext/form/Tests/Unit/Validation/DigitValidatorTest.php
typo3/sysext/form/Tests/Unit/Validation/EmailValidatorTest.php
typo3/sysext/form/Tests/Unit/Validation/EqualsValidatorTest.php
typo3/sysext/form/Tests/Unit/Validation/FileAllowedTypesValidatorTest.php
typo3/sysext/form/Tests/Unit/Validation/FileMaximumSizeValidatorTest.php
typo3/sysext/form/Tests/Unit/Validation/FileMinimumSizeValidatorTest.php
typo3/sysext/form/Tests/Unit/Validation/FloatValidatorTest.php
typo3/sysext/form/Tests/Unit/Validation/GreaterThanValidatorTest.php
typo3/sysext/form/Tests/Unit/Validation/InArrayValidatorTest.php
typo3/sysext/form/Tests/Unit/Validation/IntegerValidatorTest.php
typo3/sysext/form/Tests/Unit/Validation/IpValidatorTest.php
typo3/sysext/form/Tests/Unit/Validation/LengthValidatorTest.php
typo3/sysext/form/Tests/Unit/Validation/LessThanValidatorTest.php
typo3/sysext/form/Tests/Unit/Validation/RegExpValidatorTest.php
typo3/sysext/form/Tests/Unit/Validation/RequiredValidatorTest.php
typo3/sysext/form/Tests/Unit/Validation/UriValidatorTest.php
typo3/sysext/frontend/Tests/Unit/ContentObject/FilesContentObjectTest.php
typo3/sysext/frontend/Tests/Unit/View/AdminPanelViewTest.php
typo3/sysext/recordlist/Tests/Unit/Browser/ElementBrowserTest.php
typo3/sysext/reports/Classes/Report/Status/Typo3Status.php
typo3/sysext/reports/Tests/Unit/Report/Status/Typo3StatusTest.php

index 21e130c..1f7b63f 100644 (file)
@@ -102,7 +102,7 @@ class ModuleController {
                        $entry->setName($module['name']);
                }
                if (!empty($module['title']) && is_string($module['title'])) {
-                       $entry->setTitle($GLOBALS['LANG']->sL($module['title']));
+                       $entry->setTitle($this->getLanguageService()->sL($module['title']));
                }
                if (!empty($module['onclick']) && is_string($module['onclick'])) {
                        $entry->setOnClick($module['onclick']);
@@ -152,4 +152,12 @@ class ModuleController {
                }
        }
 
+       /**
+        * Return language service instance
+        *
+        * @return \TYPO3\CMS\Lang\LanguageService
+        */
+       protected function getLanguageService() {
+               return $GLOBALS['LANG'];
+       }
 }
index 1ec601d..b76bb9d 100644 (file)
@@ -580,7 +580,7 @@ class ConditionMatcherTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
         * @test
         */
        public function treeLevelConditionMatchesCurrentPageIdWhileEditingNewPage() {
-               $GLOBALS['SOBE'] = $this->getMock('TYPO3\\CMS\\Backend\\Controller\\EditDocumentController', array());
+               $GLOBALS['SOBE'] = $this->getMock('TYPO3\\CMS\\Backend\\Controller\\EditDocumentController', array(), array(), '', FALSE);
                $GLOBALS['SOBE']->elementsData = array(
                        array(
                                'table' => 'pages',
@@ -602,7 +602,7 @@ class ConditionMatcherTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
         * @test
         */
        public function treeLevelConditionMatchesCurrentPageIdWhileSavingNewPage() {
-               $GLOBALS['SOBE'] = $this->getMock('TYPO3\\CMS\\Backend\\Controller\\EditDocumentController', array());
+               $GLOBALS['SOBE'] = $this->getMock('TYPO3\\CMS\\Backend\\Controller\\EditDocumentController', array(), array(), '', FALSE);
                $GLOBALS['SOBE']->elementsData = array(
                        array(
                                'table' => 'pages',
@@ -675,7 +675,7 @@ class ConditionMatcherTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
         * @test
         */
        public function PIDupinRootlineConditionMatchesCurrentPageIdWhileEditingNewPage() {
-               $GLOBALS['SOBE'] = $this->getMock('TYPO3\\CMS\\Backend\\Controller\\EditDocumentController', array());
+               $GLOBALS['SOBE'] = $this->getMock('TYPO3\\CMS\\Backend\\Controller\\EditDocumentController', array(), array(), '', FALSE);
                $GLOBALS['SOBE']->elementsData = array(
                        array(
                                'table' => 'pages',
@@ -697,7 +697,7 @@ class ConditionMatcherTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
         * @test
         */
        public function PIDupinRootlineConditionMatchesCurrentPageIdWhileSavingNewPage() {
-               $GLOBALS['SOBE'] = $this->getMock('TYPO3\\CMS\\Backend\\Controller\\EditDocumentController', array());
+               $GLOBALS['SOBE'] = $this->getMock('TYPO3\\CMS\\Backend\\Controller\\EditDocumentController', array(), array(), '', FALSE);
                $GLOBALS['SOBE']->elementsData = array(
                        array(
                                'table' => 'pages',
index 185c3eb..13f6360 100644 (file)
@@ -26,20 +26,21 @@ namespace TYPO3\CMS\Backend\Tests\Unit\Module;
  *
  *  This copyright notice MUST APPEAR in all copies of the script!
  ***************************************************************/
+
 /**
- * Test class for module menu utilities
+ * Test case
  *
  * @author Susanne Moog <typo3@susannemoog.de>
  */
 class ModuleControllerTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
 
        /**
-        * @var \TYPO3\CMS\Backend\Module\ModuleController
+        * @var \TYPO3\CMS\Backend\Module\ModuleController|\PHPUnit_Framework_MockObject_MockObject|\TYPO3\CMS\Core\Tests\AccessibleObjectInterface
         */
        protected $moduleController;
 
        protected function setUp() {
-               $this->moduleController = new \TYPO3\CMS\Backend\Module\ModuleController();
+               $this->moduleController = $this->getAccessibleMock('TYPO3\\CMS\\Backend\\Module\\ModuleController', array('getLanguageService'), array(), '', FALSE);
        }
 
        protected function tearDown() {
@@ -50,7 +51,7 @@ class ModuleControllerTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
         * @test
         */
        public function createEntryFromRawDataGeneratesMenuEntry() {
-               $entry = $this->callInaccessibleMethod($this->moduleController, 'createEntryFromRawData', array());
+               $entry = $this->moduleController->_call('createEntryFromRawData', array());
                $this->assertInstanceOf('TYPO3\\CMS\\Backend\\Domain\\Model\\Module\\BackendModule', $entry);
        }
 
@@ -69,8 +70,13 @@ class ModuleControllerTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                        'description' => 'descriptionTest',
                        'navigationComponentId' => 'navigationComponentIdTest'
                );
+
+               $languageServiceMock = $this->getMock('TYPO3\\CMS\\Lang\\LanguageService', array(), array(), '', FALSE);
+               $languageServiceMock->expects($this->once())->method('sL')->will($this->returnValue('titleTest'));
+               $this->moduleController->expects($this->once())->method('getLanguageService')->will($this->returnValue($languageServiceMock));
+
                /** @var $entry \TYPO3\CMS\Backend\Domain\Model\Module\BackendModule */
-               $entry = $this->callInaccessibleMethod($this->moduleController, 'createEntryFromRawData', $rawModule);
+               $entry = $this->moduleController->_call('createEntryFromRawData', $rawModule);
                $this->assertEquals('nameTest', $entry->getName());
                $this->assertEquals('titleTest', $entry->getTitle());
                $this->assertEquals('linkTest', $entry->getLink());
@@ -88,7 +94,7 @@ class ModuleControllerTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                        'path' => 'pathTest'
                );
                /** @var $entry \TYPO3\CMS\Backend\Domain\Model\Module\BackendModule */
-               $entry = $this->callInaccessibleMethod($this->moduleController, 'createEntryFromRawData', $rawModule);
+               $entry = $this->moduleController->_call('createEntryFromRawData', $rawModule);
                $this->assertEquals('pathTest', $entry->getLink());
        }
 
index 3e568fa..627946e 100644 (file)
@@ -670,6 +670,16 @@ class BackendUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
         */
        public function getExcludeFieldsReturnsCorrectFieldList($tca, $expected) {
                $GLOBALS['TCA'] = $tca;
+
+               // Stub LanguageService and let sL() return the same value that came in again
+               $GLOBALS['LANG'] = $this->getMock('TYPO3\\CMS\\Lang\\LanguageService', array(), array(), '', FALSE);
+               $GLOBALS['LANG']->expects($this->any())->method('sL')
+                       ->will($this->returnCallback(
+                               function($name) {
+                                       return $name;
+                               }
+                       ));
+
                $this->assertSame($expected, BackendUtility::getExcludeFields());
        }
 
index 0c73f71..2ea698b 100644 (file)
@@ -121,7 +121,7 @@ class BackendFormProtection extends \TYPO3\CMS\Core\FormProtection\AbstractFormP
        protected function createValidationErrorMessage() {
                $flashMessage = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
                        'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
-                       $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:error.formProtection.tokenInvalid'),
+                       $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:error.formProtection.tokenInvalid'),
                        '',
                        \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR,
                        !(isset($GLOBALS['TYPO3_AJAX']) && $GLOBALS['TYPO3_AJAX'] === TRUE)
@@ -227,4 +227,12 @@ class BackendFormProtection extends \TYPO3\CMS\Core\FormProtection\AbstractFormP
                return isset($GLOBALS['BE_USER']) && $GLOBALS['BE_USER'] instanceof \TYPO3\CMS\Core\Authentication\BackendUserAuthentication && isset($GLOBALS['BE_USER']->user['uid']);
        }
 
+       /**
+        * Return language service instance
+        *
+        * @return \TYPO3\CMS\Lang\LanguageService
+        */
+       protected function getLanguageService() {
+               return $GLOBALS['LANG'];
+       }
 }
index 816d68d..615cd02 100644 (file)
@@ -2192,7 +2192,13 @@ class PageRenderer implements \TYPO3\CMS\Core\SingletonInterface {
                        }
                        $out .= $this->inlineJavascriptWrap[0] . '
                                Ext.ns("TYPO3");
-                               Ext.BLANK_IMAGE_URL = "' . htmlspecialchars(GeneralUtility::locationHeaderUrl(($this->backPath . 'gfx/clear.gif'))) . '";' . LF . $inlineSettings . 'Ext.onReady(function() {' . ($this->enableExtJSQuickTips ? 'Ext.QuickTips.init();' . LF : '') . $code . ' });' . $this->inlineJavascriptWrap[1];
+                               Ext.BLANK_IMAGE_URL = "' . htmlspecialchars(GeneralUtility::locationHeaderUrl(($this->backPath . 'gfx/clear.gif'))) . '";' . LF
+                               . $inlineSettings
+                               . 'Ext.onReady(function() {'
+                                       . ($this->enableExtJSQuickTips ? 'Ext.QuickTips.init();' . LF : '')
+                                       . $code
+                               . ' });'
+                               . $this->inlineJavascriptWrap[1];
                        unset($this->extOnReadyCode);
                        // Include TYPO3.l10n object
                        if (TYPO3_MODE === 'BE') {
@@ -2465,7 +2471,7 @@ class PageRenderer implements \TYPO3\CMS\Core\SingletonInterface {
                                if ($selectionPrefix === '') {
                                        $labelsFromFile[$label] = $value;
                                } elseif (strpos($label, $selectionPrefix) === 0) {
-                                       $key = preg_replace($labelPattern, '', $label);
+                                       preg_replace($labelPattern, '', $label);
                                        $labelsFromFile[$label] = $value;
                                }
                        }
index 1f96a82..d249c82 100644 (file)
@@ -32,9 +32,9 @@ namespace TYPO3\CMS\Core\Tests\Unit\FormProtection;
 class BackendFormProtectionTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
 
        /**
-        * @var $fixture \TYPO3\CMS\Core\FormProtection\BackendFormProtection|\PHPUnit_Framework_MockObject_MockObject|\TYPO3\CMS\Core\Tests\AccessibleObjectInterface
+        * @var \TYPO3\CMS\Core\FormProtection\BackendFormProtection|\PHPUnit_Framework_MockObject_MockObject|\TYPO3\CMS\Core\Tests\AccessibleObjectInterface
         */
-       protected $fixture;
+       protected $subject;
 
        /**
         * Backup of current singleton instances
@@ -53,15 +53,15 @@ class BackendFormProtectionTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                );
                $GLOBALS['BE_USER']->user['uid'] = 1;
 
-               $this->fixture = $this->getAccessibleMock(
+               $this->subject = $this->getAccessibleMock(
                        'TYPO3\\CMS\\Core\\FormProtection\BackendFormProtection',
-                       array('acquireLock', 'releaseLock')
+                       array('acquireLock', 'releaseLock', 'getLanguageService')
                );
        }
 
        public function tearDown() {
                \TYPO3\CMS\Core\Utility\GeneralUtility::resetSingletonInstances($this->singletonInstances);
-               $this->fixture->__destruct();
+               $this->subject->__destruct();
        }
 
        //////////////////////
@@ -102,7 +102,7 @@ class BackendFormProtectionTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                        ->method('getSessionData')
                        ->with('formSessionToken')
                        ->will($this->returnValue(array()));
-               $this->fixture->_call('retrieveSessionToken');
+               $this->subject->_call('retrieveSessionToken');
        }
 
        /**
@@ -124,10 +124,10 @@ class BackendFormProtectionTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                        ->with('formSessionToken')
                        ->will($this->returnValue($sessionToken));
 
-               $this->fixture->_call('retrieveSessionToken');
+               $this->subject->_call('retrieveSessionToken');
 
                $this->assertTrue(
-                       $this->fixture->validateToken($tokenId, $formName, $action, $formInstanceName)
+                       $this->subject->validateToken($tokenId, $formName, $action, $formInstanceName)
                );
        }
 
@@ -138,8 +138,8 @@ class BackendFormProtectionTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
        public function restoreSessionTokenFromRegistryThrowsExceptionIfSessionTokenIsEmpty() {
                /** @var $registryMock \TYPO3\CMS\Core\Registry */
                $registryMock = $this->getMock('TYPO3\\CMS\\Core\\Registry');
-               $this->fixture->injectRegistry($registryMock);
-               $this->fixture->setSessionTokenFromRegistry();
+               $this->subject->injectRegistry($registryMock);
+               $this->subject->setSessionTokenFromRegistry();
        }
 
        /**
@@ -147,12 +147,12 @@ class BackendFormProtectionTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
         */
        public function persistSessionTokenWritesTokenToSession() {
                $sessionToken = uniqid('test_');
-               $this->fixture->_set('sessionToken', $sessionToken);
+               $this->subject->_set('sessionToken', $sessionToken);
                $this->getBackendUser()
                        ->expects($this->once())
                        ->method('setAndSaveSessionData')
                        ->with('formSessionToken', $sessionToken);
-               $this->fixture->persistSessionToken();
+               $this->subject->persistSessionToken();
        }
 
 
@@ -181,14 +181,17 @@ class BackendFormProtectionTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                        ->expects($this->once())
                        ->method('getMessageQueueByIdentifier')
                        ->will($this->returnValue($flashMessageQueueMock));
-
                $flashMessageQueueMock
                        ->expects($this->once())
                        ->method('enqueue')
                        ->with($this->isInstanceOf('TYPO3\\CMS\\Core\\Messaging\\FlashMessage'))
                        ->will($this->returnCallback(array($this, 'enqueueFlashMessageCallback')));
 
-               $this->fixture->_call('createValidationErrorMessage');
+               $languageServiceMock = $this->getMock('TYPO3\CMS\Lang\LanguageService', array(), array(), '', FALSE);
+               $languageServiceMock->expects($this->once())->method('sL')->will($this->returnValue('foo'));
+               $this->subject->expects($this->once())->method('getLanguageService')->will($this->returnValue($languageServiceMock));
+
+               $this->subject->_call('createValidationErrorMessage');
        }
 
        /**
@@ -219,15 +222,18 @@ class BackendFormProtectionTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                        ->expects($this->once())
                        ->method('getMessageQueueByIdentifier')
                        ->will($this->returnValue($flashMessageQueueMock));
-
                $flashMessageQueueMock
                        ->expects($this->once())
                        ->method('enqueue')
                        ->with($this->isInstanceOf('TYPO3\\CMS\\Core\\Messaging\\FlashMessage'))
                        ->will($this->returnCallback(array($this, 'enqueueAjaxFlashMessageCallback')));
 
+               $languageServiceMock = $this->getMock('TYPO3\CMS\Lang\LanguageService', array(), array(), '', FALSE);
+               $languageServiceMock->expects($this->once())->method('sL')->will($this->returnValue('foo'));
+               $this->subject->expects($this->once())->method('getLanguageService')->will($this->returnValue($languageServiceMock));
+
                $GLOBALS['TYPO3_AJAX'] = TRUE;
-               $this->fixture->_call('createValidationErrorMessage');
+               $this->subject->_call('createValidationErrorMessage');
        }
 
        /**
index e12bede..ff9cb22 100644 (file)
@@ -188,7 +188,7 @@ class FileTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                        'uid' => 1,
                        'storage' => 'first',
                );
-               $sut = $this->getMock(
+               $subject = $this->getMock(
                        'TYPO3\\CMS\\Core\\Resource\\File',
                        array('loadStorage'),
                        array($fileProperties, $this->storageMock)
@@ -201,8 +201,8 @@ class FileTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                        ->will($this->returnValue($mockedNewStorage));
                \TYPO3\CMS\Core\Utility\GeneralUtility::setSingletonInstance('TYPO3\\CMS\\Core\\Resource\\ResourceFactory', $mockedResourceFactory);
 
-               $sut->updateProperties(array('storage' => 'different'));
-               $this->assertSame($mockedNewStorage, $sut->getStorage());
+               $subject->updateProperties(array('storage' => 'different'));
+               $this->assertSame($mockedNewStorage, $subject->getStorage());
        }
 
        /**
@@ -221,41 +221,41 @@ class FileTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
         * @test
         */
        public function isIndexedTriggersIndexingIfFileIsNotIndexedAlready() {
-               $sut = $this->getAccessibleMock(
+               $subject = $this->getAccessibleMock(
                        'TYPO3\\CMS\\Core\\Resource\\File',
                        array('loadIndexRecord'),
                        array(),
                        '',
                        FALSE
                );
-               $sut->_set('indexed', NULL);
-               $sut->_set('indexingInProgress', FALSE);
+               $subject->_set('indexed', NULL);
+               $subject->_set('indexingInProgress', FALSE);
 
-               $sut
+               $subject
                        ->expects($this->once())
                        ->method('loadIndexRecord');
-               $sut->isIndexed();
+               $subject->isIndexed();
        }
 
        /**
         * @test
         */
        public function fileIsAutomaticallyIndexedOnPropertyAccessIfNotAlreadyIndexed() {
-               $sut = $this->getAccessibleMock(
+               $subject = $this->getAccessibleMock(
                        'TYPO3\\CMS\\Core\\Resource\\File',
                        array('loadIndexRecord'),
                        array(),
                        '',
                        FALSE
                );
-               $sut->_set('metaDataProperties', array());
-               $sut->_set('properties', array());
+               $subject->_set('metaDataProperties', array());
+               $subject->_set('properties', array());
 
-               $sut->_set('indexed', NULL);
-               $sut
+               $subject->_set('indexed', NULL);
+               $subject
                        ->expects($this->once())
                        ->method('loadIndexRecord');
-               $sut->getProperty('foo');
+               $subject->getProperty('foo');
        }
 
        /**
index ad95ef3..8883c7c 100644 (file)
@@ -29,8 +29,6 @@ namespace TYPO3\CMS\Extensionmanager\Report;
 
 /**
  * Extension status reports
- *
- * @author Christian Kuhn <lolli@schwarzbu.ch>
  */
 class ExtensionStatus implements \TYPO3\CMS\Reports\StatusProviderInterface {
 
@@ -65,12 +63,18 @@ class ExtensionStatus implements \TYPO3\CMS\Reports\StatusProviderInterface {
        protected $listUtility = NULL;
 
        /**
+        * @var \TYPO3\CMS\Lang\LanguageService
+        */
+       protected $languageService = NULL;
+
+       /**
         * Default constructor
         */
        public function __construct() {
                $this->objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
                $this->repositoryRepository = $this->objectManager->get('TYPO3\\CMS\\Extensionmanager\\Domain\\Repository\\RepositoryRepository');
                $this->listUtility = $this->objectManager->get('TYPO3\\CMS\\Extensionmanager\\Utility\\ListUtility');
+               $this->languageService = $this->objectManager->get('TYPO3\\CMS\\Lang\\LanguageService');
        }
 
        /**
@@ -101,15 +105,15 @@ class ExtensionStatus implements \TYPO3\CMS\Reports\StatusProviderInterface {
                $mainRepository = $this->repositoryRepository->findOneTypo3OrgRepository();
 
                if (is_null($mainRepository) === TRUE) {
-                       $value = $GLOBALS['LANG']->sL('LLL:EXT:extensionmanager/Resources/Private/Language/locallang.xlf:report.status.mainRepository.notFound.value');
-                       $message = $GLOBALS['LANG']->sL('LLL:EXT:extensionmanager/Resources/Private/Language/locallang.xlf:report.status.mainRepository.notFound.message');
+                       $value = $this->languageService->sL('LLL:EXT:extensionmanager/Resources/Private/Language/locallang.xlf:report.status.mainRepository.notFound.value');
+                       $message = $this->languageService->sL('LLL:EXT:extensionmanager/Resources/Private/Language/locallang.xlf:report.status.mainRepository.notFound.message');
                        $severity = \TYPO3\CMS\Reports\Status::ERROR;
                } elseif ($mainRepository->getLastUpdate()->getTimestamp() < $GLOBALS['EXEC_TIME'] - 24 * 60 * 60 * 7) {
-                       $value = $GLOBALS['LANG']->sL('LLL:EXT:extensionmanager/Resources/Private/Language/locallang.xlf:report.status.mainRepository.notUpToDate.value');
-                       $message = $GLOBALS['LANG']->sL('LLL:EXT:extensionmanager/Resources/Private/Language/locallang.xlf:report.status.mainRepository.notUpToDate.message');
+                       $value = $this->languageService->sL('LLL:EXT:extensionmanager/Resources/Private/Language/locallang.xlf:report.status.mainRepository.notUpToDate.value');
+                       $message = $this->languageService->sL('LLL:EXT:extensionmanager/Resources/Private/Language/locallang.xlf:report.status.mainRepository.notUpToDate.message');
                        $severity = \TYPO3\CMS\Reports\Status::NOTICE;
                } else {
-                       $value = $GLOBALS['LANG']->sL('LLL:EXT:extensionmanager/Resources/Private/Language/locallang.xlf:report.status.mainRepository.upToDate.value');
+                       $value = $this->languageService->sL('LLL:EXT:extensionmanager/Resources/Private/Language/locallang.xlf:report.status.mainRepository.upToDate.value');
                        $message = '';
                        $severity = \TYPO3\CMS\Reports\Status::OK;
                }
@@ -117,7 +121,7 @@ class ExtensionStatus implements \TYPO3\CMS\Reports\StatusProviderInterface {
                /** @var $status \TYPO3\CMS\Reports\Status */
                $status = $this->objectManager->get(
                        'TYPO3\\CMS\\Reports\\Status',
-                       $GLOBALS['LANG']->sL('LLL:EXT:extensionmanager/Resources/Private/Language/locallang.xlf:report.status.mainRepository.title'),
+                       $this->languageService->sL('LLL:EXT:extensionmanager/Resources/Private/Language/locallang.xlf:report.status.mainRepository.title'),
                        $value,
                        $message,
                        $severity
@@ -182,124 +186,124 @@ class ExtensionStatus implements \TYPO3\CMS\Reports\StatusProviderInterface {
                $result = new \stdClass();
 
                if (count($loadedInsecure) === 0) {
-                       $value = $GLOBALS['LANG']->sL('LLL:EXT:extensionmanager/Resources/Private/Language/locallang.xlf:report.status.loadedExtensions.noInsecureExtensionLoaded.value');
+                       $value = $this->languageService->sL('LLL:EXT:extensionmanager/Resources/Private/Language/locallang.xlf:report.status.loadedExtensions.noInsecureExtensionLoaded.value');
                        $message = '';
                        $severity = \TYPO3\CMS\Reports\Status::OK;
                } else {
                        $value = sprintf(
-                               $GLOBALS['LANG']->sL('LLL:EXT:extensionmanager/Resources/Private/Language/locallang.xlf:report.status.loadedExtensions.insecureExtensionLoaded.value'),
+                               $this->languageService->sL('LLL:EXT:extensionmanager/Resources/Private/Language/locallang.xlf:report.status.loadedExtensions.insecureExtensionLoaded.value'),
                                count($loadedInsecure)
                        );
                        $extensionList = array();
                        foreach ($loadedInsecure as $insecureExtension) {
                                $extensionList[] = sprintf(
-                                       $GLOBALS['LANG']->sL('LLL:EXT:extensionmanager/Resources/Private/Language/locallang.xlf:report.status.loadedExtensions.insecureExtensionLoaded.message.extension'),
+                                       $this->languageService->sL('LLL:EXT:extensionmanager/Resources/Private/Language/locallang.xlf:report.status.loadedExtensions.insecureExtensionLoaded.message.extension'),
                                        $insecureExtension['extensionKey'],
                                        $insecureExtension['version']
                                );
                        }
                        $message = sprintf(
-                               $GLOBALS['LANG']->sL('LLL:EXT:extensionmanager/Resources/Private/Language/locallang.xlf:report.status.loadedExtensions.insecureExtensionLoaded.message'),
+                               $this->languageService->sL('LLL:EXT:extensionmanager/Resources/Private/Language/locallang.xlf:report.status.loadedExtensions.insecureExtensionLoaded.message'),
                                implode('', $extensionList)
                        );
                        $severity = \TYPO3\CMS\Reports\Status::ERROR;
                }
                $result->loaded = $this->objectManager->get(
                        'TYPO3\\CMS\\Reports\\Status',
-                       $GLOBALS['LANG']->sL('LLL:EXT:extensionmanager/Resources/Private/Language/locallang.xlf:report.status.loadedExtensions.title'),
+                       $this->languageService->sL('LLL:EXT:extensionmanager/Resources/Private/Language/locallang.xlf:report.status.loadedExtensions.title'),
                        $value,
                        $message,
                        $severity
                );
 
                if (count($existingInsecure) === 0) {
-                       $value = $GLOBALS['LANG']->sL('LLL:EXT:extensionmanager/Resources/Private/Language/locallang.xlf:report.status.existingExtensions.noInsecureExtensionExists.value');
+                       $value = $this->languageService->sL('LLL:EXT:extensionmanager/Resources/Private/Language/locallang.xlf:report.status.existingExtensions.noInsecureExtensionExists.value');
                        $message = '';
                        $severity = \TYPO3\CMS\Reports\Status::OK;
                } else {
                        $value = sprintf(
-                               $GLOBALS['LANG']->sL('LLL:EXT:extensionmanager/Resources/Private/Language/locallang.xlf:report.status.existingExtensions.insecureExtensionExists.value'),
+                               $this->languageService->sL('LLL:EXT:extensionmanager/Resources/Private/Language/locallang.xlf:report.status.existingExtensions.insecureExtensionExists.value'),
                                count($existingInsecure)
                        );
                        $extensionList = array();
                        foreach ($existingInsecure as $insecureExtension) {
                                $extensionList[] = sprintf(
-                                       $GLOBALS['LANG']->sL('LLL:EXT:extensionmanager/Resources/Private/Language/locallang.xlf:report.status.existingExtensions.insecureExtensionExists.message.extension'),
+                                       $this->languageService->sL('LLL:EXT:extensionmanager/Resources/Private/Language/locallang.xlf:report.status.existingExtensions.insecureExtensionExists.message.extension'),
                                        $insecureExtension['extensionKey'],
                                        $insecureExtension['version']
                                );
                        }
                        $message = sprintf(
-                               $GLOBALS['LANG']->sL('LLL:EXT:extensionmanager/Resources/Private/Language/locallang.xlf:report.status.existingExtensions.insecureExtensionExists.message'),
+                               $this->languageService->sL('LLL:EXT:extensionmanager/Resources/Private/Language/locallang.xlf:report.status.existingExtensions.insecureExtensionExists.message'),
                                implode('', $extensionList)
                        );
                        $severity = \TYPO3\CMS\Reports\Status::WARNING;
                }
                $result->existing = $this->objectManager->get(
                        'TYPO3\\CMS\\Reports\\Status',
-                       $GLOBALS['LANG']->sL('LLL:EXT:extensionmanager/Resources/Private/Language/locallang.xlf:report.status.existingExtensions.title'),
+                       $this->languageService->sL('LLL:EXT:extensionmanager/Resources/Private/Language/locallang.xlf:report.status.existingExtensions.title'),
                        $value,
                        $message,
                        $severity
                );
 
                if (count($loadedOutdated) === 0) {
-                       $value = $GLOBALS['LANG']->sL('LLL:EXT:extensionmanager/Resources/Private/Language/locallang.xlf:report.status.loadedOutdatedExtensions.noOutdatedExtensionLoaded.value');
+                       $value = $this->languageService->sL('LLL:EXT:extensionmanager/Resources/Private/Language/locallang.xlf:report.status.loadedOutdatedExtensions.noOutdatedExtensionLoaded.value');
                        $message = '';
                        $severity = \TYPO3\CMS\Reports\Status::OK;
                } else {
                        $value = sprintf(
-                               $GLOBALS['LANG']->sL('LLL:EXT:extensionmanager/Resources/Private/Language/locallang.xlf:report.status.loadedOutdatedExtensions.outdatedExtensionLoaded.value'),
+                               $this->languageService->sL('LLL:EXT:extensionmanager/Resources/Private/Language/locallang.xlf:report.status.loadedOutdatedExtensions.outdatedExtensionLoaded.value'),
                                count($loadedOutdated)
                        );
                        $extensionList = array();
                        foreach ($loadedOutdated as $outdatedExtension) {
                                $extensionList[] = sprintf(
-                                       $GLOBALS['LANG']->sL('LLL:EXT:extensionmanager/Resources/Private/Language/locallang.xlf:report.status.loadedOutdatedExtensions.outdatedExtensionLoaded.message.extension'),
+                                       $this->languageService->sL('LLL:EXT:extensionmanager/Resources/Private/Language/locallang.xlf:report.status.loadedOutdatedExtensions.outdatedExtensionLoaded.message.extension'),
                                        $outdatedExtension['extensionKey'],
                                        $outdatedExtension['version']
                                );
                        }
                        $message = sprintf(
-                               $GLOBALS['LANG']->sL('LLL:EXT:extensionmanager/Resources/Private/Language/locallang.xlf:report.status.loadedOutdatedExtensions.outdatedExtensionLoaded.message'),
+                               $this->languageService->sL('LLL:EXT:extensionmanager/Resources/Private/Language/locallang.xlf:report.status.loadedOutdatedExtensions.outdatedExtensionLoaded.message'),
                                implode('', $extensionList)
                        );
                        $severity = \TYPO3\CMS\Reports\Status::WARNING;
                }
                $result->loadedoutdated = $this->objectManager->get(
                        'TYPO3\\CMS\\Reports\\Status',
-                       $GLOBALS['LANG']->sL('LLL:EXT:extensionmanager/Resources/Private/Language/locallang.xlf:report.status.loadedOutdatedExtensions.title'),
+                       $this->languageService->sL('LLL:EXT:extensionmanager/Resources/Private/Language/locallang.xlf:report.status.loadedOutdatedExtensions.title'),
                        $value,
                        $message,
                        $severity
                );
 
                if (count($existingOutdated) === 0) {
-                       $value = $GLOBALS['LANG']->sL('LLL:EXT:extensionmanager/Resources/Private/Language/locallang.xlf:report.status.existingOutdatedExtensions.noOutdatedExtensionExists.value');
+                       $value = $this->languageService->sL('LLL:EXT:extensionmanager/Resources/Private/Language/locallang.xlf:report.status.existingOutdatedExtensions.noOutdatedExtensionExists.value');
                        $message = '';
                        $severity = \TYPO3\CMS\Reports\Status::OK;
                } else {
                        $value = sprintf(
-                               $GLOBALS['LANG']->sL('LLL:EXT:extensionmanager/Resources/Private/Language/locallang.xlf:report.status.existingOutdatedExtensions.outdatedExtensionExists.value'),
+                               $this->languageService->sL('LLL:EXT:extensionmanager/Resources/Private/Language/locallang.xlf:report.status.existingOutdatedExtensions.outdatedExtensionExists.value'),
                                count($existingOutdated)
                        );
                        $extensionList = array();
                        foreach ($existingOutdated as $outdatedExtension) {
                                $extensionList[] = sprintf(
-                                       $GLOBALS['LANG']->sL('LLL:EXT:extensionmanager/Resources/Private/Language/locallang.xlf:report.status.existingOutdatedExtensions.outdatedExtensionExists.message.extension'),
+                                       $this->languageService->sL('LLL:EXT:extensionmanager/Resources/Private/Language/locallang.xlf:report.status.existingOutdatedExtensions.outdatedExtensionExists.message.extension'),
                                        $outdatedExtension['extensionKey'],
                                        $outdatedExtension['version']
                                );
                        }
                        $message = sprintf(
-                               $GLOBALS['LANG']->sL('LLL:EXT:extensionmanager/Resources/Private/Language/locallang.xlf:report.status.existingOutdatedExtensions.outdatedExtensionExists.message'),
+                               $this->languageService->sL('LLL:EXT:extensionmanager/Resources/Private/Language/locallang.xlf:report.status.existingOutdatedExtensions.outdatedExtensionExists.message'),
                                implode('', $extensionList)
                        );
                        $severity = \TYPO3\CMS\Reports\Status::WARNING;
                }
                $result->existingoutdated = $this->objectManager->get(
                        'TYPO3\\CMS\\Reports\\Status',
-                       $GLOBALS['LANG']->sL('LLL:EXT:extensionmanager/Resources/Private/Language/locallang.xlf:report.status.existingOutdatedExtensions.title'),
+                       $this->languageService->sL('LLL:EXT:extensionmanager/Resources/Private/Language/locallang.xlf:report.status.existingOutdatedExtensions.title'),
                        $value,
                        $message,
                        $severity
index 912ed28..3be7c23 100644 (file)
@@ -28,8 +28,6 @@ use TYPO3\CMS\Extensionmanager\Report;
 
 /**
  * Test case
- *
- * @author Christian Kuhn <lolli@schwarzbu.ch>
  */
 class ExtensionStatusTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
 
@@ -43,10 +41,19 @@ class ExtensionStatusTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
         */
        protected $mockRepositoryRepository;
 
+       /**
+        * @var \TYPO3\CMS\Lang\LanguageService
+        */
+       protected $mockLanguageService;
+
+       /**
+        * Set up
+        */
        public function setUp() {
                $this->mockObjectManager = $this->getMock('TYPO3\\CMS\\Extbase\\Object\\ObjectManagerInterface');
                /** @var $mockRepositoryRepository \TYPO3\CMS\Extensionmanager\Domain\Repository\RepositoryRepository|\PHPUnit_Framework_MockObject_MockObject */
                $this->mockRepositoryRepository = $this->getMock('TYPO3\\CMS\\Extensionmanager\\Domain\\Repository\\RepositoryRepository', array(), array($this->mockObjectManager));
+               $this->mockLanguageService = $this->getMock('TYPO3\\CMS\\Lang\\LanguageService', array(), array(), '', FALSE);
        }
 
        /**
@@ -115,14 +122,17 @@ class ExtensionStatusTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
                        ->expects($this->once())
                        ->method('getAvailableAndInstalledExtensionsWithAdditionalInformation')
                        ->will($this->returnValue($mockExtensionList));
+
                /** @var $mockReport \TYPO3\CMS\Extensionmanager\Report\ExtensionStatus|\PHPUnit_Framework_MockObject_MockObject */
                $mockReport = $this->getAccessibleMock('TYPO3\\CMS\\Extensionmanager\\Report\\ExtensionStatus', array('getMainRepositoryStatus'), array(), '', FALSE);
                $mockReport->_set('objectManager', $this->mockObjectManager);
                $mockReport->_set('listUtility', $mockListUtility);
+               $mockReport->_set('languageService', $this->mockLanguageService);
                $mockReport
                        ->expects($this->once())
                        ->method('getMainRepositoryStatus')
                        ->will($this->returnValue('foo'));
+
                $result = $mockReport->getStatus();
                $this->assertSame('foo', $result['mainRepositoryStatus']);
        }
@@ -140,6 +150,7 @@ class ExtensionStatusTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
                $mockReport = $this->getAccessibleMock('TYPO3\\CMS\\Extensionmanager\\Report\\ExtensionStatus', array('dummy'), array(), '', FALSE);
                $mockReport->_set('objectManager', $this->objectManager);
                $mockReport->_set('repositoryRepository', $this->mockRepositoryRepository);
+               $mockReport->_set('languageService', $this->mockLanguageService);
 
                /** @var $result \TYPO3\CMS\Reports\Status */
                $result = $mockReport->_call('getMainRepositoryStatus');
@@ -166,6 +177,7 @@ class ExtensionStatusTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
                $mockReport = $this->getAccessibleMock('TYPO3\\CMS\\Extensionmanager\\Report\\ExtensionStatus', array('dummy'), array(), '', FALSE);
                $mockReport->_set('objectManager', $this->objectManager);
                $mockReport->_set('repositoryRepository', $this->mockRepositoryRepository);
+               $mockReport->_set('languageService', $this->mockLanguageService);
 
                /** @var $result \TYPO3\CMS\Reports\Status */
                $result = $mockReport->_call('getMainRepositoryStatus');
@@ -192,6 +204,7 @@ class ExtensionStatusTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
                $mockReport = $this->getAccessibleMock('TYPO3\\CMS\\Extensionmanager\\Report\\ExtensionStatus', array('dummy'), array(), '', FALSE);
                $mockReport->_set('objectManager', $this->objectManager);
                $mockReport->_set('repositoryRepository', $this->mockRepositoryRepository);
+               $mockReport->_set('languageService', $this->mockLanguageService);
 
                /** @var $result \TYPO3\CMS\Reports\Status */
                $result = $mockReport->_call('getMainRepositoryStatus');
@@ -229,6 +242,7 @@ class ExtensionStatusTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
                $mockReport = $this->getAccessibleMock('TYPO3\\CMS\\Extensionmanager\\Report\\ExtensionStatus', array('dummy'), array(), '', FALSE);
                $mockReport->_set('objectManager', $this->objectManager);
                $mockReport->_set('listUtility', $mockListUtility);
+               $mockReport->_set('languageService', $this->mockLanguageService);
 
                $result = $mockReport->_call('getSecurityStatusOfExtensions');
                /** @var $loadedResult \TYPO3\CMS\Reports\Status */
@@ -267,6 +281,7 @@ class ExtensionStatusTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
                $mockReport = $this->getAccessibleMock('TYPO3\\CMS\\Extensionmanager\\Report\\ExtensionStatus', array('dummy'), array(), '', FALSE);
                $mockReport->_set('objectManager', $this->objectManager);
                $mockReport->_set('listUtility', $mockListUtility);
+               $mockReport->_set('languageService', $this->mockLanguageService);
 
                $result = $mockReport->_call('getSecurityStatusOfExtensions');
                /** @var $loadedResult \TYPO3\CMS\Reports\Status */
@@ -304,6 +319,7 @@ class ExtensionStatusTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
                $mockReport = $this->getAccessibleMock('TYPO3\\CMS\\Extensionmanager\\Report\\ExtensionStatus', array('dummy'), array(), '', FALSE);
                $mockReport->_set('objectManager', $this->objectManager);
                $mockReport->_set('listUtility', $mockListUtility);
+               $mockReport->_set('languageService', $this->mockLanguageService);
 
                $result = $mockReport->_call('getSecurityStatusOfExtensions');
                /** @var $existingResult \TYPO3\CMS\Reports\Status */
@@ -341,6 +357,7 @@ class ExtensionStatusTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
                $mockReport = $this->getAccessibleMock('TYPO3\\CMS\\Extensionmanager\\Report\\ExtensionStatus', array('dummy'), array(), '', FALSE);
                $mockReport->_set('objectManager', $this->objectManager);
                $mockReport->_set('listUtility', $mockListUtility);
+               $mockReport->_set('languageService', $this->mockLanguageService);
 
                $result = $mockReport->_call('getSecurityStatusOfExtensions');
                /** @var $existingResult \TYPO3\CMS\Reports\Status */
@@ -379,6 +396,7 @@ class ExtensionStatusTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
                $mockReport = $this->getAccessibleMock('TYPO3\\CMS\\Extensionmanager\\Report\\ExtensionStatus', array('dummy'), array(), '', FALSE);
                $mockReport->_set('objectManager', $this->objectManager);
                $mockReport->_set('listUtility', $mockListUtility);
+               $mockReport->_set('languageService', $this->mockLanguageService);
 
                $result = $mockReport->_call('getSecurityStatusOfExtensions');
                /** @var $loadedResult \TYPO3\CMS\Reports\Status */
@@ -417,6 +435,7 @@ class ExtensionStatusTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
                $mockReport = $this->getAccessibleMock('TYPO3\\CMS\\Extensionmanager\\Report\\ExtensionStatus', array('dummy'), array(), '', FALSE);
                $mockReport->_set('objectManager', $this->objectManager);
                $mockReport->_set('listUtility', $mockListUtility);
+               $mockReport->_set('languageService', $this->mockLanguageService);
 
                $result = $mockReport->_call('getSecurityStatusOfExtensions');
                /** @var $loadedResult \TYPO3\CMS\Reports\Status */
@@ -454,6 +473,7 @@ class ExtensionStatusTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
                $mockReport = $this->getAccessibleMock('TYPO3\\CMS\\Extensionmanager\\Report\\ExtensionStatus', array('dummy'), array(), '', FALSE);
                $mockReport->_set('objectManager', $this->objectManager);
                $mockReport->_set('listUtility', $mockListUtility);
+               $mockReport->_set('languageService', $this->mockLanguageService);
 
                $result = $mockReport->_call('getSecurityStatusOfExtensions');
                /** @var $existingResult \TYPO3\CMS\Reports\Status */
@@ -491,6 +511,7 @@ class ExtensionStatusTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
                $mockReport = $this->getAccessibleMock('TYPO3\\CMS\\Extensionmanager\\Report\\ExtensionStatus', array('dummy'), array(), '', FALSE);
                $mockReport->_set('objectManager', $this->objectManager);
                $mockReport->_set('listUtility', $mockListUtility);
+               $mockReport->_set('languageService', $this->mockLanguageService);
 
                $result = $mockReport->_call('getSecurityStatusOfExtensions');
                /** @var $existingResult \TYPO3\CMS\Reports\Status */
index 4a2247a..da47557 100644 (file)
@@ -26,9 +26,7 @@ namespace TYPO3\CMS\Form\Tests\Unit\Validation;
 ***************************************************************/
 
 /**
- * Test case for class \TYPO3\CMS\Form\System\Validation\AlphabeticValidator.
- *
- * @author Andreas Lappe <a.lappe@kuehlhaus.com>
+ * Test case
  */
 class AlphabeticValidatorTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
        /**
@@ -39,17 +37,26 @@ class AlphabeticValidatorTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase
        /**
         * @var \TYPO3\CMS\Form\Validation\AlphabeticValidator
         */
-       protected $fixture;
+       protected $subject;
 
+       /**
+        * Set up
+        */
        public function setUp() {
                $this->helper = new \TYPO3\CMS\Form\Tests\Unit\Validation\Helper();
-               $this->fixture = new \TYPO3\CMS\Form\Validation\AlphabeticValidator();
+               $this->subject = $this->getMock('TYPO3\\CMS\\Form\\Validation\\AlphabeticValidator', array('dummy'), array(), '', FALSE);
        }
 
+       /**
+        * Tear down
+        */
        public function tearDown() {
-               unset($this->helper, $this->fixture);
+               unset($this->helper, $this->subject);
        }
 
+       /**
+        * @return array
+        */
        public function validDataProviderWithoutWhitespace() {
                return array(
                        'ascii without spaces' => array('thisismyinput'),
@@ -59,6 +66,9 @@ class AlphabeticValidatorTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase
                );
        }
 
+       /**
+        * @return array
+        */
        public function validDataProviderWithWhitespace() {
                return array(
                        'ascii with spaces' => array('This is my input'),
@@ -69,6 +79,9 @@ class AlphabeticValidatorTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase
                );
        }
 
+       /**
+        * @return array
+        */
        public function invalidDataProviderWithoutWhitespace() {
                return array(
                        'ascii with dash' => array('my-name'),
@@ -78,6 +91,9 @@ class AlphabeticValidatorTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase
                );
        }
 
+       /**
+        * @return array
+        */
        public function invalidDataProviderWithWhitespace() {
                return array(
                        'ascii with spaces and dashes' => array('This is my-name'),
@@ -95,11 +111,11 @@ class AlphabeticValidatorTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase
                        'name' => $input
                ));
 
-               $this->fixture->setFieldName('name');
-               $this->fixture->injectRequestHandler($requestHandlerMock);
+               $this->subject->setFieldName('name');
+               $this->subject->injectRequestHandler($requestHandlerMock);
 
                $this->assertTrue(
-                       $this->fixture->isValid()
+                       $this->subject->isValid()
                );
        }
 
@@ -112,12 +128,12 @@ class AlphabeticValidatorTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase
                        'name' => $input
                ));
 
-               $this->fixture->setAllowWhiteSpace(TRUE);
-               $this->fixture->setFieldName('name');
-               $this->fixture->injectRequestHandler($requestHandlerMock);
+               $this->subject->setAllowWhiteSpace(TRUE);
+               $this->subject->setFieldName('name');
+               $this->subject->injectRequestHandler($requestHandlerMock);
 
                $this->assertTrue(
-                       $this->fixture->isValid()
+                       $this->subject->isValid()
                );
        }
 
@@ -130,11 +146,11 @@ class AlphabeticValidatorTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase
                        'name' => $input
                ));
 
-               $this->fixture->setFieldName('name');
-               $this->fixture->injectRequestHandler($requestHandlerMock);
+               $this->subject->setFieldName('name');
+               $this->subject->injectRequestHandler($requestHandlerMock);
 
                $this->assertFalse(
-                       $this->fixture->isValid()
+                       $this->subject->isValid()
                );
        }
 
@@ -147,12 +163,12 @@ class AlphabeticValidatorTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase
                        'name' => $input
                ));
 
-               $this->fixture->setAllowWhiteSpace(TRUE);
-               $this->fixture->setFieldName('name');
-               $this->fixture->injectRequestHandler($requestHandlerMock);
+               $this->subject->setAllowWhiteSpace(TRUE);
+               $this->subject->setFieldName('name');
+               $this->subject->injectRequestHandler($requestHandlerMock);
 
                $this->assertFalse(
-                       $this->fixture->isValid()
+                       $this->subject->isValid()
                );
        }
 }
index 6ba5cf3..9970a40 100644 (file)
@@ -25,9 +25,7 @@ namespace TYPO3\CMS\Form\Tests\Unit\Validation;
 ***************************************************************/
 
 /**
- * Test case for class \TYPO3\CMS\Form\Validation\AlphanumericValidator.
- *
- * @author Andreas Lappe <a.lappe@kuehlhaus.com>
+ * Test case
  */
 class AlphanumericValidatorTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
        /**
@@ -38,15 +36,15 @@ class AlphanumericValidatorTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCa
        /**
         * @var \TYPO3\CMS\Form\Validation\AlphanumericValidator
         */
-       protected $fixture;
+       protected $subject;
 
        public function setUp() {
                $this->helper = new \TYPO3\CMS\Form\Tests\Unit\Validation\Helper();
-               $this->fixture = new \TYPO3\CMS\Form\Validation\AlphanumericValidator(array());
+               $this->subject = $this->getMock('TYPO3\\CMS\\Form\\Validation\\AlphanumericValidator', array('dummy'), array(), '', FALSE);
        }
 
        public function tearDown() {
-               unset($this->helper, $this->fixture);
+               unset($this->helper, $this->subject);
        }
 
        public function validDataProviderWithoutWhitespace() {
@@ -94,11 +92,11 @@ class AlphanumericValidatorTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCa
                        'name' => $input
                ));
 
-               $this->fixture->setFieldName('name');
-               $this->fixture->injectRequestHandler($requestHandlerMock);
+               $this->subject->setFieldName('name');
+               $this->subject->injectRequestHandler($requestHandlerMock);
 
                $this->assertTrue(
-                       $this->fixture->isValid()
+                       $this->subject->isValid()
                );
        }
 
@@ -111,12 +109,12 @@ class AlphanumericValidatorTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCa
                        'name' => $input
                ));
 
-               $this->fixture->setAllowWhiteSpace(TRUE);
-               $this->fixture->setFieldName('name');
-               $this->fixture->injectRequestHandler($requestHandlerMock);
+               $this->subject->setAllowWhiteSpace(TRUE);
+               $this->subject->setFieldName('name');
+               $this->subject->injectRequestHandler($requestHandlerMock);
 
                $this->assertTrue(
-                       $this->fixture->isValid()
+                       $this->subject->isValid()
                );
        }
 
@@ -129,11 +127,11 @@ class AlphanumericValidatorTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCa
                        'name' => $input
                ));
 
-               $this->fixture->setFieldName('name');
-               $this->fixture->injectRequestHandler($requestHandlerMock);
+               $this->subject->setFieldName('name');
+               $this->subject->injectRequestHandler($requestHandlerMock);
 
                $this->assertFalse(
-                       $this->fixture->isValid()
+                       $this->subject->isValid()
                );
        }
 
@@ -146,12 +144,12 @@ class AlphanumericValidatorTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCa
                        'name' => $input
                ));
 
-               $this->fixture->setAllowWhiteSpace(TRUE);
-               $this->fixture->setFieldName('name');
-               $this->fixture->injectRequestHandler($requestHandlerMock);
+               $this->subject->setAllowWhiteSpace(TRUE);
+               $this->subject->setFieldName('name');
+               $this->subject->injectRequestHandler($requestHandlerMock);
 
                $this->assertFalse(
-                       $this->fixture->isValid()
+                       $this->subject->isValid()
                );
        }
 }
index 56c502c..702a482 100644 (file)
@@ -26,9 +26,7 @@ namespace TYPO3\CMS\Form\Tests\Unit\Validation;
 ***************************************************************/
 
 /**
- * Test case for class \TYPO3\CMS\Form\Validation\BetweenValidator.
- *
- * @author Andreas Lappe <a.lappe@kuehlhaus.com>
+ * Test case
  */
 class BetweenValidatorTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
        /**
@@ -39,15 +37,15 @@ class BetweenValidatorTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
        /**
         * @var \TYPO3\CMS\Form\Validation\BetweenValidator
         */
-       protected $fixture;
+       protected $subject;
 
        public function setUp() {
                $this->helper = new \TYPO3\CMS\Form\Tests\Unit\Validation\Helper();
-               $this->fixture = new \TYPO3\CMS\Form\Validation\BetweenValidator(array());
+               $this->subject = $this->getMock('TYPO3\\CMS\\Form\\Validation\\BetweenValidator', array('dummy'), array(), '', FALSE);
        }
 
        public function tearDown() {
-               unset($this->helper, $this->fixture);
+               unset($this->helper, $this->subject);
        }
 
        public function validNonInclusiveDataProvider() {
@@ -92,16 +90,16 @@ class BetweenValidatorTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
         * @dataProvider validNonInclusiveDataProvider
         */
        public function isValidWithValidInputAndWithoutInclusiveReturnsTrue($input) {
-               $this->fixture->setMinimum($input[0]);
-               $this->fixture->setMaximum($input[2]);
-               $this->fixture->setFieldName('numericValue');
+               $this->subject->setMinimum($input[0]);
+               $this->subject->setMaximum($input[2]);
+               $this->subject->setFieldName('numericValue');
                $requestHandlerMock = $this->helper->getRequestHandler(array(
                        'numericValue' => $input[1]
                ));
-               $this->fixture->injectRequestHandler($requestHandlerMock);
+               $this->subject->injectRequestHandler($requestHandlerMock);
 
                $this->assertTrue(
-                       $this->fixture->isValid()
+                       $this->subject->isValid()
                );
        }
 
@@ -110,17 +108,17 @@ class BetweenValidatorTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
         * @dataProvider validInclusiveDataProvider
         */
        public function isValidWithValidInputAndWithInclusiveReturnsTrue($input) {
-               $this->fixture->setMinimum($input[0]);
-               $this->fixture->setMaximum($input[2]);
-               $this->fixture->setFieldName('numericValue');
-               $this->fixture->setInclusive(TRUE);
+               $this->subject->setMinimum($input[0]);
+               $this->subject->setMaximum($input[2]);
+               $this->subject->setFieldName('numericValue');
+               $this->subject->setInclusive(TRUE);
                $requestHandlerMock = $this->helper->getRequestHandler(array(
                        'numericValue' => $input[1]
                ));
-               $this->fixture->injectRequestHandler($requestHandlerMock);
+               $this->subject->injectRequestHandler($requestHandlerMock);
 
                $this->assertTrue(
-                       $this->fixture->isValid()
+                       $this->subject->isValid()
                );
        }
 
@@ -129,16 +127,16 @@ class BetweenValidatorTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
         * @dataProvider invalidNonInclusiveDataProvider
         */
        public function isValidWithInvalidInputAndWithoutInclusiveReturnsFalse($input) {
-               $this->fixture->setMinimum($input[0]);
-               $this->fixture->setMaximum($input[2]);
-               $this->fixture->setFieldName('numericValue');
+               $this->subject->setMinimum($input[0]);
+               $this->subject->setMaximum($input[2]);
+               $this->subject->setFieldName('numericValue');
                $requestHandlerMock = $this->helper->getRequestHandler(array(
                        'numericValue' => $input[1]
                ));
-               $this->fixture->injectRequestHandler($requestHandlerMock);
+               $this->subject->injectRequestHandler($requestHandlerMock);
 
                $this->assertFalse(
-                       $this->fixture->isValid()
+                       $this->subject->isValid()
                );
        }
 
@@ -147,17 +145,17 @@ class BetweenValidatorTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
         * @dataProvider invalidInclusiveDataProvider
         */
        public function isValidWithInvalidInputAndWithInclusiveReturnsFalse($input) {
-               $this->fixture->setMinimum($input[0]);
-               $this->fixture->setMaximum($input[2]);
-               $this->fixture->setFieldName('numericValue');
-               $this->fixture->setInclusive(TRUE);
+               $this->subject->setMinimum($input[0]);
+               $this->subject->setMaximum($input[2]);
+               $this->subject->setFieldName('numericValue');
+               $this->subject->setInclusive(TRUE);
                $requestHandlerMock = $this->helper->getRequestHandler(array(
                        'numericValue' => $input[1]
                ));
-               $this->fixture->injectRequestHandler($requestHandlerMock);
+               $this->subject->injectRequestHandler($requestHandlerMock);
 
                $this->assertFalse(
-                       $this->fixture->isValid()
+                       $this->subject->isValid()
                );
        }
 }
index 4091d34..9e42c31 100644 (file)
@@ -25,11 +25,10 @@ namespace TYPO3\CMS\Form\Tests\Unit\Validation;
 ***************************************************************/
 
 /**
- * Test case for class \TYPO3\CMS\Form\Validation\DateValidator.
- *
- * @author Andreas Lappe <a.lappe@kuehlhaus.com>
+ * Test case
  */
 class DateValidatorTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
+
        /**
         * @var \TYPO3\CMS\Form\Tests\Unit\Validation\Helper
         */
@@ -38,15 +37,15 @@ class DateValidatorTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
        /**
         * @var \TYPO3\CMS\Form\Validation\DateValidator
         */
-       protected $fixture;
+       protected $subject;
 
        public function setUp() {
                $this->helper = new \TYPO3\CMS\Form\Tests\Unit\Validation\Helper();
-               $this->fixture = new \TYPO3\CMS\Form\Validation\DateValidator(array());
+               $this->subject = $this->getMock('TYPO3\\CMS\\Form\\Validation\\DateValidator', array('dummy'), array(), '', FALSE);
        }
 
        public function tearDown() {
-               unset($this->helper, $this->fixture);
+               unset($this->helper, $this->subject);
        }
 
        public function validDateProvider() {
@@ -70,15 +69,15 @@ class DateValidatorTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
         * @dataProvider validDateProvider
         */
        public function isValidForValidInputReturnsTrue($input) {
-               $this->fixture->setFormat($input[0]);
-               $this->fixture->setFieldName('myDate');
+               $this->subject->setFormat($input[0]);
+               $this->subject->setFieldName('myDate');
                $requestHandlerMock = $this->helper->getRequestHandler(array(
                        'myDate' => $input[1]
                ));
-               $this->fixture->injectRequestHandler($requestHandlerMock);
+               $this->subject->injectRequestHandler($requestHandlerMock);
 
                $this->assertTrue(
-                       $this->fixture->isValid()
+                       $this->subject->isValid()
                );
        }
 
@@ -87,15 +86,15 @@ class DateValidatorTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
         * @dataProvider invalidDateProvider
         */
        public function isValidForInvalidInputReturnsFalse($input) {
-               $this->fixture->setFormat($input[0]);
-               $this->fixture->setFieldName('myDate');
+               $this->subject->setFormat($input[0]);
+               $this->subject->setFieldName('myDate');
                $requestHandlerMock = $this->helper->getRequestHandler(array(
                        'myDate' => $input[1]
                ));
-               $this->fixture->injectRequestHandler($requestHandlerMock);
+               $this->subject->injectRequestHandler($requestHandlerMock);
 
                $this->assertFalse(
-                       $this->fixture->isValid()
+                       $this->subject->isValid()
                );
        }
 }
index e3e91f5..d91b394 100644 (file)
@@ -25,9 +25,7 @@ namespace TYPO3\CMS\Form\Tests\Unit\Validation;
 ***************************************************************/
 
 /**
- * Test case for class \TYPO3\CMS\Form\Validation\DigitValidator.
- *
- * @author Andreas Lappe <a.lappe@kuehlhaus.com>
+ * Test case
  */
 class DigitValidatorTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
        /**
@@ -38,15 +36,15 @@ class DigitValidatorTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
        /**
         * @var \TYPO3\CMS\Form\Validation\DigitValidator
         */
-       protected $fixture;
+       protected $subject;
 
        public function setUp() {
                $this->helper = new \TYPO3\CMS\Form\Tests\Unit\Validation\Helper();
-               $this->fixture = new \TYPO3\CMS\Form\Validation\DigitValidator(array());
+               $this->subject = $this->getMock('TYPO3\\CMS\\Form\\Validation\\DigitValidator', array('dummy'), array(), '', FALSE);
        }
 
        public function tearDown() {
-               unset($this->helper, $this->fixture);
+               unset($this->helper, $this->subject);
        }
 
        public function validDigitProvider() {
@@ -68,14 +66,14 @@ class DigitValidatorTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
         * @dataProvider validDigitProvider
         */
        public function isValidForValidInputReturnsTrue($input) {
-               $this->fixture->setFieldName('myDigit');
+               $this->subject->setFieldName('myDigit');
                $requestHandlerMock = $this->helper->getRequestHandler(array(
                        'myDigit' => $input
                ));
-               $this->fixture->injectRequestHandler($requestHandlerMock);
+               $this->subject->injectRequestHandler($requestHandlerMock);
 
                $this->assertTrue(
-                       $this->fixture->isValid()
+                       $this->subject->isValid()
                );
        }
 
@@ -84,14 +82,14 @@ class DigitValidatorTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
         * @dataProvider invalidDigitProvider
         */
        public function isValidForInvalidInputReturnsFalse($input) {
-               $this->fixture->setFieldName('myDigit');
+               $this->subject->setFieldName('myDigit');
                $requestHandlerMock = $this->helper->getRequestHandler(array(
                        'myDigit' => $input
                ));
-               $this->fixture->injectRequestHandler($requestHandlerMock);
+               $this->subject->injectRequestHandler($requestHandlerMock);
 
                $this->assertFalse(
-                       $this->fixture->isValid()
+                       $this->subject->isValid()
                );
        }
 }
index ce0584b..1938797 100644 (file)
@@ -26,8 +26,6 @@ namespace TYPO3\CMS\Form\Tests\Unit\Validation;
 
 /**
  * Test case
- *
- * @author Andreas Lappe <a.lappe@kuehlhaus.com>
  */
 class EmailValidatorTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
 
@@ -39,15 +37,15 @@ class EmailValidatorTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
        /**
         * @var \TYPO3\CMS\Form\Validation\EmailValidator
         */
-       protected $fixture;
+       protected $subject;
 
        public function setUp() {
                $this->helper = new \TYPO3\CMS\Form\Tests\Unit\Validation\Helper();
-               $this->fixture = new \TYPO3\CMS\Form\Validation\EmailValidator(array());
+               $this->subject = $this->getMock('TYPO3\\CMS\\Form\\Validation\\EmailValidator', array('dummy'), array(), '', FALSE);
        }
 
        public function tearDown() {
-               unset($this->helper, $this->fixture);
+               unset($this->helper, $this->subject);
        }
 
        public function validEmailProvider() {
@@ -70,14 +68,14 @@ class EmailValidatorTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
         * @dataProvider validEmailProvider
         */
        public function isValidForValidInputReturnsTrue($input) {
-               $this->fixture->setFieldName('myEmail');
+               $this->subject->setFieldName('myEmail');
                $requestHandlerMock = $this->helper->getRequestHandler(array(
                        'myEmail' => $input
                ));
-               $this->fixture->injectRequestHandler($requestHandlerMock);
+               $this->subject->injectRequestHandler($requestHandlerMock);
 
                $this->assertTrue(
-                       $this->fixture->isValid()
+                       $this->subject->isValid()
                );
        }
 
@@ -86,14 +84,14 @@ class EmailValidatorTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
         * @dataProvider invalidEmailProvider
         */
        public function isValidForInvalidInputReturnsFalse($input) {
-               $this->fixture->setFieldName('myEmail');
+               $this->subject->setFieldName('myEmail');
                $requestHandlerMock = $this->helper->getRequestHandler(array(
                        'myEmail' => $input
                ));
-               $this->fixture->injectRequestHandler($requestHandlerMock);
+               $this->subject->injectRequestHandler($requestHandlerMock);
 
                $this->assertFalse(
-                       $this->fixture->isValid()
+                       $this->subject->isValid()
                );
        }
 }
index 8603d5e..ae88622 100644 (file)
@@ -25,11 +25,10 @@ namespace TYPO3\CMS\Form\Tests\Unit\Validation;
 ***************************************************************/
 
 /**
- * Test case for class \TYPO3\CMS\Form\Validation\EqualsValidator.
- *
- * @author Andreas Lappe <a.lappe@kuehlhaus.com>
+ * Test case
  */
 class EqualsValidatorTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
+
        /**
         * @var \TYPO3\CMS\Form\Tests\Unit\Validation\Helper
         */
@@ -38,15 +37,15 @@ class EqualsValidatorTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
        /**
         * @var \TYPO3\CMS\Form\Validation\EqualsValidator
         */
-       protected $fixture;
+       protected $subject;
 
        public function setUp() {
                $this->helper = new \TYPO3\CMS\Form\Tests\Unit\Validation\Helper();
-               $this->fixture = new \TYPO3\CMS\Form\Validation\EqualsValidator(array());
+               $this->subject = $this->getMock('TYPO3\\CMS\\Form\\Validation\\EqualsValidator', array('dummy'), array(), '', FALSE);
        }
 
        public function tearDown() {
-               unset($this->helper, $this->fixture);
+               unset($this->helper, $this->subject);
        }
 
        public function invalidPairProvider() {
@@ -61,16 +60,16 @@ class EqualsValidatorTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
         * @dataProvider invalidPairProvider
         */
        public function isValidForInvalidInputReturnsFalse($input) {
-               $this->fixture->setFieldName('myField');
-               $this->fixture->setField($input[0]);
+               $this->subject->setFieldName('myField');
+               $this->subject->setField($input[0]);
                $requestHandlerMock = $this->helper->getRequestHandler(array(
                        'myField' => $input[1],
                        $input[0] => TRUE
                ));
-               $this->fixture->injectRequestHandler($requestHandlerMock);
+               $this->subject->injectRequestHandler($requestHandlerMock);
 
                $this->assertFalse(
-                       $this->fixture->isValid()
+                       $this->subject->isValid()
                );
        }
 }
index 661e572..a27b328 100644 (file)
@@ -25,9 +25,7 @@ namespace TYPO3\CMS\Form\Tests\Unit\Validation;
 ***************************************************************/
 
 /**
- * Test case for class \TYPO3\CMS\Form\Validation\FileAllowedTypesValidator.
- *
- * @author Andreas Lappe <a.lappe@kuehlhaus.com>
+ * Test case
  */
 class FileAllowedTypesValidatorTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
        /**
@@ -38,15 +36,15 @@ class FileAllowedTypesValidatorTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTe
        /**
         * @var \TYPO3\CMS\Form\Validation\FileAllowedTypesValidator
         */
-       protected $fixture;
+       protected $subject;
 
        public function setUp() {
                $this->helper = new \TYPO3\CMS\Form\Tests\Unit\Validation\Helper();
-               $this->fixture = new \TYPO3\CMS\Form\Validation\FileAllowedTypesValidator(array());
+               $this->subject = $this->getMock('TYPO3\\CMS\\Form\\Validation\\FileAllowedTypesValidator', array('dummy'), array(), '', FALSE);
        }
 
        public function tearDown() {
-               unset($this->helper, $this->fixture);
+               unset($this->helper, $this->subject);
        }
 
        public function validTypesProvider() {
@@ -68,15 +66,15 @@ class FileAllowedTypesValidatorTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTe
         * @dataProvider validTypesProvider
         */
        public function isValidForValidInputReturnsTrue($input) {
-               $this->fixture->setFieldName('myFile');
-               $this->fixture->setAllowedTypes($input[0]);
+               $this->subject->setFieldName('myFile');
+               $this->subject->setAllowedTypes($input[0]);
                $requestHandlerMock = $this->helper->getRequestHandler(array(
                        'myFile' => array('type' => $input[1])
                ));
-               $this->fixture->injectRequestHandler($requestHandlerMock);
+               $this->subject->injectRequestHandler($requestHandlerMock);
 
                $this->assertTrue(
-                       $this->fixture->isValid()
+                       $this->subject->isValid()
                );
        }
 
@@ -85,15 +83,15 @@ class FileAllowedTypesValidatorTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTe
         * @dataProvider invalidTypesProvider
         */
        public function isValidForInvalidInputReturnsFalse($input) {
-               $this->fixture->setFieldName('myFile');
-               $this->fixture->setAllowedTypes($input[0]);
+               $this->subject->setFieldName('myFile');
+               $this->subject->setAllowedTypes($input[0]);
                $requestHandlerMock = $this->helper->getRequestHandler(array(
                        'myFile' => array('type' => $input[1])
                ));
-               $this->fixture->injectRequestHandler($requestHandlerMock);
+               $this->subject->injectRequestHandler($requestHandlerMock);
 
                $this->assertFalse(
-                       $this->fixture->isValid()
+                       $this->subject->isValid()
                );
        }
 }
index 504addb..f895712 100644 (file)
@@ -25,9 +25,7 @@ namespace TYPO3\CMS\Form\Tests\Unit\Validation;
 ***************************************************************/
 
 /**
- * Test case for class \TYPO3\CMS\Form\Validation\FileMaximumSizeValidator.
- *
- * @author Andreas Lappe <a.lappe@kuehlhaus.com>
+ * Test case
  */
 class FileMaximumSizeValidatorTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
        /**
@@ -38,15 +36,15 @@ class FileMaximumSizeValidatorTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTes
        /**
         * @var \TYPO3\CMS\Form\Validation\FileMaximumSizeValidator
         */
-       protected $fixture;
+       protected $subject;
 
        public function setUp() {
                $this->helper = new \TYPO3\CMS\Form\Tests\Unit\Validation\Helper();
-               $this->fixture = new \TYPO3\CMS\Form\Validation\FileMaximumSizeValidator(array());
+               $this->subject = $this->getMock('TYPO3\\CMS\\Form\\Validation\\FileMaximumSizeValidator', array('dummy'), array(), '', FALSE);
        }
 
        public function tearDown() {
-               unset($this->helper, $this->fixture);
+               unset($this->helper, $this->subject);
        }
 
        public function validSizesProvider() {
@@ -67,15 +65,15 @@ class FileMaximumSizeValidatorTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTes
         * @dataProvider validSizesProvider
         */
        public function isValidForValidInputReturnsTrue($input) {
-               $this->fixture->setFieldName('myFile');
-               $this->fixture->setMaximum($input[0]);
+               $this->subject->setFieldName('myFile');
+               $this->subject->setMaximum($input[0]);
                $requestHandlerMock = $this->helper->getRequestHandler(array(
                        'myFile' => array('size' => $input[1])
                ));
-               $this->fixture->injectRequestHandler($requestHandlerMock);
+               $this->subject->injectRequestHandler($requestHandlerMock);
 
                $this->assertTrue(
-                       $this->fixture->isValid()
+                       $this->subject->isValid()
                );
        }
 
@@ -84,15 +82,15 @@ class FileMaximumSizeValidatorTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTes
         * @dataProvider inValidSizesProvider
         */
        public function isValidForInvalidInputReturnsFalse($input) {
-               $this->fixture->setFieldName('myFile');
-               $this->fixture->setMaximum($input[0]);
+               $this->subject->setFieldName('myFile');
+               $this->subject->setMaximum($input[0]);
                $requestHandlerMock = $this->helper->getRequestHandler(array(
                        'myFile' => array('size' => $input[1])
                ));
-               $this->fixture->injectRequestHandler($requestHandlerMock);
+               $this->subject->injectRequestHandler($requestHandlerMock);
 
                $this->assertFalse(
-                       $this->fixture->isValid()
+                       $this->subject->isValid()
                );
        }
 }
index 7dd5ab7..e12f4a9 100644 (file)
@@ -26,11 +26,10 @@ namespace TYPO3\CMS\Form\Tests\Unit\Validation;
 ***************************************************************/
 
 /**
- * Test case for class \TYPO3\CMS\Form\Validation\FileMinimumSizeValidator.
- *
- * @author Andreas Lappe <a.lappe@kuehlhaus.com>
+ * Test case
  */
 class FileMinimumSizeValidatorTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
+
        /**
         * @var \TYPO3\CMS\Form\Tests\Unit\Validation\Helper
         */
@@ -39,15 +38,15 @@ class FileMinimumSizeValidatorTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTes
        /**
         * @var \TYPO3\CMS\Form\Validation\FileMinimumSizeValidator
         */
-       protected $fixture;
+       protected $subject;
 
        public function setUp() {
                $this->helper = new \TYPO3\CMS\Form\Tests\Unit\Validation\Helper();
-               $this->fixture = new \TYPO3\CMS\Form\Validation\FileMinimumSizeValidator(array());
+               $this->subject = $this->getMock('TYPO3\\CMS\\Form\\Validation\\FileMinimumSizeValidator', array('dummy'), array(), '', FALSE);
        }
 
        public function tearDown() {
-               unset($this->helper, $this->fixture);
+               unset($this->helper, $this->subject);
        }
 
        public function validSizesProvider() {
@@ -68,15 +67,15 @@ class FileMinimumSizeValidatorTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTes
         * @dataProvider validSizesProvider
         */
        public function isValidForValidInputReturnsTrue($input) {
-               $this->fixture->setFieldName('myFile');
-               $this->fixture->setMinimum($input[0]);
+               $this->subject->setFieldName('myFile');
+               $this->subject->setMinimum($input[0]);
                $requestHandlerMock = $this->helper->getRequestHandler(array(
                        'myFile' => array('size' => $input[1])
                ));
-               $this->fixture->injectRequestHandler($requestHandlerMock);
+               $this->subject->injectRequestHandler($requestHandlerMock);
 
                $this->assertTrue(
-                       $this->fixture->isValid()
+                       $this->subject->isValid()
                );
        }
 
@@ -85,15 +84,15 @@ class FileMinimumSizeValidatorTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTes
         * @dataProvider invalidSizesProvider
         */
        public function isValidForInvalidInputReturnsFalse($input) {
-               $this->fixture->setFieldName('myFile');
-               $this->fixture->setMinimum($input[0]);
+               $this->subject->setFieldName('myFile');
+               $this->subject->setMinimum($input[0]);
                $requestHandlerMock = $this->helper->getRequestHandler(array(
                        'myFile' => array('size' => $input[1])
                ));
-               $this->fixture->injectRequestHandler($requestHandlerMock);
+               $this->subject->injectRequestHandler($requestHandlerMock);
 
                $this->assertFalse(
-                       $this->fixture->isValid()
+                       $this->subject->isValid()
                );
        }
 }
index da6203f..ca3eac0 100644 (file)
@@ -25,9 +25,7 @@ namespace TYPO3\CMS\Form\Tests\Unit\Validation;
 ***************************************************************/
 
 /**
- * Test case for class \TYPO3\CMS\Form\Validation\FloatValidator.
- *
- * @author Andreas Lappe <a.lappe@kuehlhaus.com>
+ * Test case
  */
 class FloatValidatorTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
        /**
@@ -38,15 +36,15 @@ class FloatValidatorTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
        /**
         * @var \TYPO3\CMS\Form\Validation\FloatValidator
         */
-       protected $fixture;
+       protected $subject;
 
        public function setUp() {
                $this->helper = new \TYPO3\CMS\Form\Tests\Unit\Validation\Helper();
-               $this->fixture = new \TYPO3\CMS\Form\Validation\FloatValidator(array());
+               $this->subject = $this->getMock('TYPO3\\CMS\\Form\\Validation\\FloatValidator', array('dummy'), array(), '', FALSE);
        }
 
        public function tearDown() {
-               unset($this->helper, $this->fixture);
+               unset($this->helper, $this->subject);
        }
 
        public function validFloatProvider() {
@@ -60,15 +58,15 @@ class FloatValidatorTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
         * @dataProvider validFloatProvider
         */
        public function isValidForValidInputReturnsTrue($input) {
-               $this->fixture->setFieldName('myFile');
+               $this->subject->setFieldName('myFile');
                setlocale(LC_NUMERIC, $input[1]);
                $requestHandlerMock = $this->helper->getRequestHandler(array(
                        'myFile' => $input[0]
                ));
-               $this->fixture->injectRequestHandler($requestHandlerMock);
+               $this->subject->injectRequestHandler($requestHandlerMock);
 
                $this->assertTrue(
-                       $this->fixture->isValid()
+                       $this->subject->isValid()
                );
        }
 }
index 158ffc9..4bb6200 100644 (file)
@@ -26,11 +26,10 @@ namespace TYPO3\CMS\Form\Tests\Unit\Validation;
 ***************************************************************/
 
 /**
- * Test case for class \TYPO3\CMS\Form\Validation\GreaterThanValidator.
- *
- * @author Andreas Lappe <a.lappe@kuehlhaus.com>
+ * Test case
  */
 class GreaterThanValidatorTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
+
        /**
         * @var \TYPO3\CMS\Form\Tests\Unit\Validation\Helper
         */
@@ -39,15 +38,15 @@ class GreaterThanValidatorTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCas
        /**
         * @var \TYPO3\CMS\Form\Validation\GreaterThanValidator
         */
-       protected $fixture;
+       protected $subject;
 
        public function setUp() {
                $this->helper = new \TYPO3\CMS\Form\Tests\Unit\Validation\Helper();
-               $this->fixture = new \TYPO3\CMS\Form\Validation\GreaterThanValidator(array());
+               $this->subject = $this->getMock('TYPO3\\CMS\\Form\\Validation\\GreaterThanValidator', array('dummy'), array(), '', FALSE);
        }
 
        public function tearDown() {
-               unset($this->helper, $this->fixture);
+               unset($this->helper, $this->subject);
        }
 
        public function validNumberProvider() {
@@ -69,15 +68,15 @@ class GreaterThanValidatorTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCas
         * @dataProvider validNumberProvider
         */
        public function isValidForValidInputReturnsTrue($input) {
-               $this->fixture->setFieldName('myFile');
-               $this->fixture->setMinimum($input[0]);
+               $this->subject->setFieldName('myFile');
+               $this->subject->setMinimum($input[0]);
                $requestHandlerMock = $this->helper->getRequestHandler(array(
                        'myFile' => $input[1]
                ));
-               $this->fixture->injectRequestHandler($requestHandlerMock);
+               $this->subject->injectRequestHandler($requestHandlerMock);
 
                $this->assertTrue(
-                       $this->fixture->isValid()
+                       $this->subject->isValid()
                );
        }
 
@@ -86,15 +85,15 @@ class GreaterThanValidatorTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCas
         * @dataProvider invalidNumberProvider
         */
        public function isValidForInvalidInputReturnsFalse($input) {
-               $this->fixture->setFieldName('myFile');
-               $this->fixture->setMinimum($input[0]);
+               $this->subject->setFieldName('myFile');
+               $this->subject->setMinimum($input[0]);
                $requestHandlerMock = $this->helper->getRequestHandler(array(
                        'myFile' => $input[1]
                ));
-               $this->fixture->injectRequestHandler($requestHandlerMock);
+               $this->subject->injectRequestHandler($requestHandlerMock);
 
                $this->assertFalse(
-                       $this->fixture->isValid()
+                       $this->subject->isValid()
                );
        }
 }
index 3f20d7e..dc2254d 100644 (file)
@@ -25,11 +25,10 @@ namespace TYPO3\CMS\Form\Tests\Unit\Validation;
 ***************************************************************/
 
 /**
- * Test case for class \TYPO3\CMS\Form\Validation\InArrayValidator.
- *
- * @author Andreas Lappe <a.lappe@kuehlhaus.com>
+ * Test case
  */
 class InArrayValidatorTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
+
        /**
         * @var \TYPO3\CMS\Form\Tests\Unit\Validation\Helper
         */
@@ -38,15 +37,15 @@ class InArrayValidatorTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
        /**
         * @var \TYPO3\CMS\Form\Validation\InArrayValidator
         */
-       protected $fixture;
+       protected $subject;
 
        public function setUp() {
                $this->helper = new \TYPO3\CMS\Form\Tests\Unit\Validation\Helper();
-               $this->fixture = new \TYPO3\CMS\Form\Validation\InArrayValidator(array('array.' => array(), 'strict' => FALSE));
+               $this->subject = $this->getMock('TYPO3\\CMS\\Form\\Validation\\InArrayValidator', array('dummy'), array(), '', FALSE);
        }
 
        public function tearDown() {
-               unset($this->helper, $this->fixture);
+               unset($this->helper, $this->subject);
        }
 
        public function validArrayProvider() {
@@ -66,15 +65,15 @@ class InArrayValidatorTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
         * @dataProvider validArrayProvider
         */
        public function isValidForValidInputReturnsTrue($input) {
-               $this->fixture->setFieldName('myfield');
-               $this->fixture->setArray($input[0]);
+               $this->subject->setFieldName('myfield');
+               $this->subject->setArray($input[0]);
                $requestHandlerMock = $this->helper->getRequestHandler(array(
                        'myfield' => $input[1]
                ));
-               $this->fixture->injectRequestHandler($requestHandlerMock);
+               $this->subject->injectRequestHandler($requestHandlerMock);
 
                $this->assertTrue(
-                       $this->fixture->isValid()
+                       $this->subject->isValid()
                );
        }
 
@@ -83,15 +82,15 @@ class InArrayValidatorTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
         * @dataProvider invalidArrayProvider
         */
        public function isValidForInvalidInputReturnsFalse($input) {
-               $this->fixture->setFieldName('myfield');
-               $this->fixture->setArray($input[0]);
+               $this->subject->setFieldName('myfield');
+               $this->subject->setArray($input[0]);
                $requestHandlerMock = $this->helper->getRequestHandler(array(
                        'myfield' => $input[1]
                ));
-               $this->fixture->injectRequestHandler($requestHandlerMock);
+               $this->subject->injectRequestHandler($requestHandlerMock);
 
                $this->assertFalse(
-                       $this->fixture->isValid()
+                       $this->subject->isValid()
                );
        }
 
@@ -100,16 +99,16 @@ class InArrayValidatorTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
         * @dataProvider validArrayProvider
         */
        public function isValidForValidInputWithStrictComparisonReturnsTrue($input) {
-               $this->fixture->setFieldName('myfield');
-               $this->fixture->setArray($input[0]);
-               $this->fixture->setStrict(TRUE);
+               $this->subject->setFieldName('myfield');
+               $this->subject->setArray($input[0]);
+               $this->subject->setStrict(TRUE);
                $requestHandlerMock = $this->helper->getRequestHandler(array(
                        'myfield' => $input[1]
                ));
-               $this->fixture->injectRequestHandler($requestHandlerMock);
+               $this->subject->injectRequestHandler($requestHandlerMock);
 
                $this->assertTrue(
-                       $this->fixture->isValid()
+                       $this->subject->isValid()
                );
        }
 
@@ -118,16 +117,16 @@ class InArrayValidatorTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
         * @dataProvider invalidArrayProvider
         */
        public function isValidForInvalidInputWithStrictComparisonReturnsFalse($input) {
-               $this->fixture->setFieldName('myfield');
-               $this->fixture->setArray($input[0]);
-               $this->fixture->setStrict(TRUE);
+               $this->subject->setFieldName('myfield');
+               $this->subject->setArray($input[0]);
+               $this->subject->setStrict(TRUE);
                $requestHandlerMock = $this->helper->getRequestHandler(array(
                        'myfield' => $input[1]
                ));
-               $this->fixture->injectRequestHandler($requestHandlerMock);
+               $this->subject->injectRequestHandler($requestHandlerMock);
 
                $this->assertFalse(
-                       $this->fixture->isValid()
+                       $this->subject->isValid()
                );
        }
 }
index 72c3285..67c3d4b 100644 (file)
@@ -25,9 +25,7 @@ namespace TYPO3\CMS\Form\Tests\Unit\Validation;
 ***************************************************************/
 
 /**
- * Test case for class \TYPO3\CMS\Form\Validation\IntegerValidator.
- *
- * @author Andreas Lappe <a.lappe@kuehlhaus.com>
+ * Test case
  */
 class IntegerValidatorTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
        /**
@@ -38,15 +36,15 @@ class IntegerValidatorTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
        /**
         * @var \TYPO3\CMS\Form\Validation\IntegerValidator
         */
-       protected $fixture;
+       protected $subject;
 
        public function setUp() {
                $this->helper = new \TYPO3\CMS\Form\Tests\Unit\Validation\Helper();
-               $this->fixture = new \TYPO3\CMS\Form\Validation\IntegerValidator(array());
+               $this->subject = $this->getMock('TYPO3\\CMS\\Form\\Validation\\IntegerValidator', array('dummy'), array(), '', FALSE);
        }
 
        public function tearDown() {
-               unset($this->helper, $this->fixture);
+               unset($this->helper, $this->subject);
        }
 
        public function validIntegerProvider() {
@@ -67,15 +65,15 @@ class IntegerValidatorTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
         * @dataProvider validIntegerProvider
         */
        public function isValidForValidInputReturnsTrue($input) {
-               $this->fixture->setFieldName('myFile');
+               $this->subject->setFieldName('myFile');
                setlocale(LC_NUMERIC, $input[1]);
                $requestHandlerMock = $this->helper->getRequestHandler(array(
                        'myFile' => $input[0]
                ));
-               $this->fixture->injectRequestHandler($requestHandlerMock);
+               $this->subject->injectRequestHandler($requestHandlerMock);
 
                $this->assertTrue(
-                       $this->fixture->isValid()
+                       $this->subject->isValid()
                );
        }
 
@@ -84,15 +82,15 @@ class IntegerValidatorTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
         * @dataProvider invalidIntegerProvider
         */
        public function isValidForInvalidInputReturnsFalse($input) {
-               $this->fixture->setFieldName('myFile');
+               $this->subject->setFieldName('myFile');
                setlocale(LC_NUMERIC, $input[1]);
                $requestHandlerMock = $this->helper->getRequestHandler(array(
                        'myFile' => $input[0]
                ));
-               $this->fixture->injectRequestHandler($requestHandlerMock);
+               $this->subject->injectRequestHandler($requestHandlerMock);
 
                $this->assertFalse(
-                       $this->fixture->isValid()
+                       $this->subject->isValid()
                );
        }
 }
index eea8e72..c5f9cc0 100644 (file)
@@ -25,11 +25,10 @@ namespace TYPO3\CMS\Form\Tests\Unit\Validation;
 ***************************************************************/
 
 /**
- * Test case for class \TYPO3\CMS\Form\Validation\IpValidator.
- *
- * @author Andreas Lappe <a.lappe@kuehlhaus.com>
+ * Test case
  */
 class IpValidatorTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
+
        /**
         * @var \TYPO3\CMS\Form\Tests\Unit\Validation\Helper
         */
@@ -38,16 +37,16 @@ class IpValidatorTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
        /**
         * @var \TYPO3\CMS\Form\Validation\IpValidator
         */
-       protected $fixture;
+       protected $subject;
 
        public function setUp() {
                $this->helper = new \TYPO3\CMS\Form\Tests\Unit\Validation\Helper();
-               $this->fixture = new \TYPO3\CMS\Form\Validation\IpValidator(array());
+               $this->subject = $this->getMock('TYPO3\\CMS\\Form\\Validation\\IpValidator', array('dummy'), array(), '', FALSE);
        }
 
        public function tearDown() {
                unset($this->helper);
-               unset($this->fixture);
+               unset($this->subject);
        }
 
        public function validIpv4Provider() {
@@ -71,14 +70,14 @@ class IpValidatorTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
         * @dataProvider validIpv4Provider
         */
        public function isValidForValidInputReturnsTrue($input) {
-               $this->fixture->setFieldName('myIp');
+               $this->subject->setFieldName('myIp');
                $requestHandlerMock = $this->helper->getRequestHandler(array(
                        'myIp' => $input
                ));
-               $this->fixture->injectRequestHandler($requestHandlerMock);
+               $this->subject->injectRequestHandler($requestHandlerMock);
 
                $this->assertTrue(
-                       $this->fixture->isValid()
+                       $this->subject->isValid()
                );
        }
 
@@ -87,14 +86,14 @@ class IpValidatorTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
         * @dataProvider invalidIpv4Provider
         */
        public function isValidForInvalidInputReturnsFalse($input) {
-               $this->fixture->setFieldName('myIp');
+               $this->subject->setFieldName('myIp');
                $requestHandlerMock = $this->helper->getRequestHandler(array(
                        'myIp' => $input
                ));
-               $this->fixture->injectRequestHandler($requestHandlerMock);
+               $this->subject->injectRequestHandler($requestHandlerMock);
 
                $this->assertFalse(
-                       $this->fixture->isValid()
+                       $this->subject->isValid()
                );
        }
 }
index 9a3b1fd..d2a16db 100644 (file)
@@ -25,11 +25,10 @@ namespace TYPO3\CMS\Form\Tests\Unit\Validation;
 ***************************************************************/
 
 /**
- * Test case for class \TYPO3\CMS\Form\Validation\LengthValidator.
- *
- * @author Andreas Lappe <a.lappe@kuehlhaus.com>
+ * Test case
  */
 class LengthValidatorTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
+
        /**
         * @var \TYPO3\CMS\Form\Tests\Unit\Validation\Helper
         */
@@ -38,30 +37,46 @@ class LengthValidatorTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
        /**
         * @var \TYPO3\CMS\Form\Validation\LengthValidator
         */
-       protected $fixture;
+       protected $subject;
 
+       /**
+        * Set up
+        */
        public function setUp() {
                $this->helper = new \TYPO3\CMS\Form\Tests\Unit\Validation\Helper();
-               $this->fixture = new \TYPO3\CMS\Form\Validation\LengthValidator(array('minimum' => 0, 'maximum' => 0));
+               $charsetConverterMock = $this->getMock('TYPO3\\CMS\\Core\\Charset\\CharsetConverter', array(), array(), '', FALSE);
+               $charsetConverterMock->expects($this->any())->method('strlen')
+                       ->will($this->returnCallback(function ($charset, $value) {
+                               return mb_strlen($value, $charset);
+                       }));
+               $this->subject = $this->getAccessibleMock('TYPO3\\CMS\\Form\\Validation\\LengthValidator', array('dummy'), array(), '', FALSE);
+               $this->subject->_set('charsetConverter', $charsetConverterMock);
        }
 
+       /**
+        * Tear down
+        */
        public function tearDown() {
-               unset($this->helper, $this->fixture);
+               unset($this->helper, $this->subject);
        }
 
+       /**
+        * @return array
+        */
        public function validLengthProvider() {
                return array(
-                       '4 ≤ length(myString) ≤ 8' => array(array(4, 8, 'mäString')),
-                       '8 ≤ length(myString) ≤ 8' => array(array(8, 8, 'möString')),
-                       '4 ≤ length(myString)'       => array(array(4, NULL, 'myString')),
-                       '4 ≤ length(asdf) ≤ 4'     => array(array(4, 4, 'asdf')),
-               );
-       }
-
-       public function invalidLengthProvider() {
-               return array(
-                       '4 ≤ length(my) ≤ 12'             => array(array(4, 12, 'my')),
-                       '4 ≤ length(my long string) ≤ 12' => array(array(4, 12, 'my long string')),
+                       '4 ≤ length(myString) ≤ 8' => array(
+                               array(4, 8, 'mäString')
+                       ),
+                       '8 ≤ length(myString) ≤ 8' => array(
+                               array(8, 8, 'möString')
+                       ),
+                       '4 ≤ length(myString)' => array(
+                               array(4, NULL, 'myString')
+                       ),
+                       '4 ≤ length(asdf) ≤ 4' => array(
+                               array(4, 4, 'asdf')
+                       ),
                );
        }
 
@@ -70,16 +85,30 @@ class LengthValidatorTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
         * @dataProvider validLengthProvider
         */
        public function isValidForValidInputReturnsTrue($input) {
-               $this->fixture->setFieldName('myLength');
-               $this->fixture->setMinimum($input[0]);
-               $this->fixture->setMaximum($input[1]);
+               $this->subject->setFieldName('myLength');
+               $this->subject->setMinimum($input[0]);
+               $this->subject->setMaximum($input[1]);
                $requestHandlerMock = $this->helper->getRequestHandler(array(
                        'myLength' => $input[2]
                ));
-               $this->fixture->injectRequestHandler($requestHandlerMock);
+               $this->subject->injectRequestHandler($requestHandlerMock);
 
                $this->assertTrue(
-                       $this->fixture->isValid()
+                       $this->subject->isValid()
+               );
+       }
+
+       /**
+        * @return array
+        */
+       public function invalidLengthProvider() {
+               return array(
+                       '4 ≤ length(my) ≤ 12' => array(
+                               array(4, 12, 'my')
+                       ),
+                       '4 ≤ length(my long string) ≤ 12' => array(
+                               array(4, 12, 'my long string')
+                       ),
                );
        }
 
@@ -88,16 +117,16 @@ class LengthValidatorTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
         * @dataProvider invalidLengthProvider
         */
        public function isValidForInvalidInputReturnsFalse($input) {
-               $this->fixture->setFieldName('myLength');
-               $this->fixture->setMinimum($input[0]);
-               $this->fixture->setMaximum($input[1]);
+               $this->subject->setFieldName('myLength');
+               $this->subject->setMinimum($input[0]);
+               $this->subject->setMaximum($input[1]);
                $requestHandlerMock = $this->helper->getRequestHandler(array(
                        'myLength' => $input[2]
                ));
-               $this->fixture->injectRequestHandler($requestHandlerMock);
+               $this->subject->injectRequestHandler($requestHandlerMock);
 
                $this->assertFalse(
-                       $this->fixture->isValid()
+                       $this->subject->isValid()
                );
        }
 }
index f3ac505..0e48f54 100644 (file)
@@ -25,11 +25,10 @@ namespace TYPO3\CMS\Form\Tests\Unit\Validation;
 ***************************************************************/
 
 /**
- * Test case for class \TYPO3\CMS\Form\Validation\LessThanValidator.
- *
- * @author Andreas Lappe <a.lappe@kuehlhaus.com>
+ * Test case
  */
 class LessThanValidatorTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
+
        /**
         * @var \TYPO3\CMS\Form\Tests\Unit\Validation\Helper
         */
@@ -38,15 +37,15 @@ class LessThanValidatorTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
        /**
         * @var \TYPO3\CMS\Form\Validation\LessthanValidator
         */
-       protected $fixture;
+       protected $subject;
 
        public function setUp() {
                $this->helper = new \TYPO3\CMS\Form\Tests\Unit\Validation\Helper();
-               $this->fixture = new \TYPO3\CMS\Form\Validation\LessthanValidator(array('maximum' => 0));
+               $this->subject = $this->getMock('TYPO3\\CMS\\Form\\Validation\\LessthanValidator', array('dummy'), array(), '', FALSE);
        }
 
        public function tearDown() {
-               unset($this->helper, $this->fixture);
+               unset($this->helper, $this->subject);
        }
 
        public function validValueProvider() {
@@ -67,15 +66,15 @@ class LessThanValidatorTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
         * @dataProvider validValueProvider
         */
        public function isValidForValidInputReturnsTrue($input) {
-               $this->fixture->setFieldName('myLessthan');
-               $this->fixture->setMaximum($input[0]);
+               $this->subject->setFieldName('myLessthan');
+               $this->subject->setMaximum($input[0]);
                $requestHandlerMock = $this->helper->getRequestHandler(array(
                        'myLessthan' => $input[1]
                ));
-               $this->fixture->injectRequestHandler($requestHandlerMock);
+               $this->subject->injectRequestHandler($requestHandlerMock);
 
                $this->assertTrue(
-                       $this->fixture->isValid()
+                       $this->subject->isValid()
                );
        }
 
@@ -84,15 +83,15 @@ class LessThanValidatorTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
         * @dataProvider invalidValueProvider
         */
        public function isValidForInvalidInputReturnsFalse($input) {
-               $this->fixture->setFieldName('myLessthan');
-               $this->fixture->setMaximum($input[0]);
+               $this->subject->setFieldName('myLessthan');
+               $this->subject->setMaximum($input[0]);
                $requestHandlerMock = $this->helper->getRequestHandler(array(
                        'myLessthan' => $input[1]
                ));
-               $this->fixture->injectRequestHandler($requestHandlerMock);
+               $this->subject->injectRequestHandler($requestHandlerMock);
 
                $this->assertFalse(
-                       $this->fixture->isValid()
+                       $this->subject->isValid()
                );
        }
 }
index 163a5bd..d3dab1e 100644 (file)
@@ -25,11 +25,10 @@ namespace TYPO3\CMS\Form\Tests\Unit\Validation;
 ***************************************************************/
 
 /**
- * Test case for class \TYPO3\CMS\Form\Validation\RegExpValidator.
- *
- * @author Andreas Lappe <a.lappe@kuehlhaus.com>
+ * Test case
  */
 class RegExpValidatorTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
+
        /**
         * @var \TYPO3\CMS\Form\Tests\Unit\Validation\Helper
         */
@@ -38,15 +37,15 @@ class RegExpValidatorTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
        /**
         * @var \TYPO3\CMS\Form\Validation\RegExpValidator
         */
-       protected $fixture;
+       protected $subject;
 
        public function setUp() {
                $this->helper = new \TYPO3\CMS\Form\Tests\Unit\Validation\Helper();
-               $this->fixture = new \TYPO3\CMS\Form\Validation\RegExpValidator(array('expression' => ''));
+               $this->subject = $this->getMock('TYPO3\\CMS\\Form\\Validation\\RegExpValidator', array('dummy'), array(), '', FALSE);
        }
 
        public function tearDown() {
-               unset($this->helper, $this->fixture);
+               unset($this->helper, $this->subject);
        }
 
        public function validDataProvider() {
@@ -66,15 +65,15 @@ class RegExpValidatorTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
         * @dataProvider validDataProvider
         */
        public function isValidForValidInputReturnsTrue($input) {
-               $this->fixture->setFieldName('myRegexp');
-               $this->fixture->setRegularExpression($input[0]);
+               $this->subject->setFieldName('myRegexp');
+               $this->subject->setRegularExpression($input[0]);
                $requestHandlerMock = $this->helper->getRequestHandler(array(
                        'myRegexp' => $input[1]
                ));
-               $this->fixture->injectRequestHandler($requestHandlerMock);
+               $this->subject->injectRequestHandler($requestHandlerMock);
 
                $this->assertTrue(
-                       $this->fixture->isValid()
+                       $this->subject->isValid()
                );
        }
 
@@ -83,15 +82,15 @@ class RegExpValidatorTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
         * @dataProvider invalidDataProvider
         */
        public function isValidForInvalidInputReturnsFalse($input) {
-               $this->fixture->setFieldName('myRegexp');
-               $this->fixture->setRegularExpression($input[0]);
+               $this->subject->setFieldName('myRegexp');
+               $this->subject->setRegularExpression($input[0]);
                $requestHandlerMock = $this->helper->getRequestHandler(array(
                        'myRegexp' => $input[1]
                ));
-               $this->fixture->injectRequestHandler($requestHandlerMock);
+               $this->subject->injectRequestHandler($requestHandlerMock);
 
                $this->assertFalse(
-                       $this->fixture->isValid()
+                       $this->subject->isValid()
                );
        }
 }
index 82a5fc7..103f234 100644 (file)
@@ -25,11 +25,10 @@ namespace TYPO3\CMS\Form\Tests\Unit\Validation;
 ***************************************************************/
 
 /**
- * Test case for class \TYPO3\CMS\Form\Validation\RequiredValidator.
- *
- * @author Andreas Lappe <a.lappe@kuehlhaus.com>
+ * Test case
  */
 class RequiredValidatorTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
+
        /**
         * @var \TYPO3\CMS\Form\Tests\Unit\Validation\Helper
         */
@@ -38,15 +37,15 @@ class RequiredValidatorTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
        /**
         * @var \TYPO3\CMS\Form\Validation\RequiredValidator
         */
-       protected $fixture;
+       protected $subject;
 
        public function setUp() {
                $this->helper = new \TYPO3\CMS\Form\Tests\Unit\Validation\Helper();
-               $this->fixture = new \TYPO3\CMS\Form\Validation\RequiredValidator(array());
+               $this->subject = $this->getMock('TYPO3\\CMS\\Form\\Validation\\RequiredValidator', array('dummy'), array(), '', FALSE);
        }
 
        public function tearDown() {
-               unset($this->helper, $this->fixture);
+               unset($this->helper, $this->subject);
        }
 
        public function validDataProvider() {
@@ -69,14 +68,14 @@ class RequiredValidatorTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
         * @dataProvider validDataProvider
         */
        public function isValidForValidDataReturnsTrue($input) {
-               $this->fixture->setFieldName('myRequired');
+               $this->subject->setFieldName('myRequired');
                $requestHandlerMock = $this->helper->getRequestHandler(array(
                        'myRequired' => $input
                ));
-               $this->fixture->injectRequestHandler($requestHandlerMock);
+               $this->subject->injectRequestHandler($requestHandlerMock);
 
                $this->assertTrue(
-                       $this->fixture->isValid()
+                       $this->subject->isValid()
                );
        }
 
@@ -85,14 +84,14 @@ class RequiredValidatorTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
         * @dataProvider invalidDataProvider
         */
        public function isValidForInvalidDataReturnsFalse($input) {
-               $this->fixture->setFieldName('myRequired');
+               $this->subject->setFieldName('myRequired');
                $requestHandlerMock = $this->helper->getRequestHandler(array(
                        'myRequired' => $input
                ));
-               $this->fixture->injectRequestHandler($requestHandlerMock);
+               $this->subject->injectRequestHandler($requestHandlerMock);
 
                $this->assertFalse(
-                       $this->fixture->isValid()
+                       $this->subject->isValid()
                );
        }
 }
index b51239d..735fb96 100644 (file)
@@ -25,11 +25,10 @@ namespace TYPO3\CMS\Form\Tests\Unit\Validation;
 ***************************************************************/
 
 /**
- * Test case for class \TYPO3\CMS\Form\Validation\UriValidator.
- *
- * @author Andreas Lappe <a.lappe@kuehlhaus.com>
+ * Test case
  */
 class UriValidatorTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
+
        /**
         * @var \TYPO3\CMS\Form\Tests\Unit\Validation\Helper
         */
@@ -38,15 +37,15 @@ class UriValidatorTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
        /**
         * @var \TYPO3\CMS\Form\Validation\UriValidator
         */
-       protected $fixture;
+       protected $subject;
 
        public function setUp() {
                $this->helper = new \TYPO3\CMS\Form\Tests\Unit\Validation\Helper();
-               $this->fixture = new \TYPO3\CMS\Form\Validation\UriValidator(array());
+               $this->subject = $this->getMock('TYPO3\\CMS\\Form\\Validation\\UriValidator', array('dummy'), array(), '', FALSE);
        }
 
        public function tearDown() {
-               unset($this->helper, $this->fixture);
+               unset($this->helper, $this->subject);
        }
 
        public function validDataProvider() {
@@ -68,14 +67,14 @@ class UriValidatorTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
         * @dataProvider validDataProvider
         */
        public function isValidForValidInputReturnsTrue($input) {
-               $this->fixture->setFieldName('myUri');
+               $this->subject->setFieldName('myUri');
                $requestHandlerMock = $this->helper->getRequestHandler(array(
                        'myUri' => $input
                ));
-               $this->fixture->injectRequestHandler($requestHandlerMock);
+               $this->subject->injectRequestHandler($requestHandlerMock);
 
                $this->assertTrue(
-                       $this->fixture->isValid()
+                       $this->subject->isValid()
                );
        }
 
@@ -84,14 +83,14 @@ class UriValidatorTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
         * @dataProvider invalidDataProvider
         */
        public function isValidForInvalidInputReturnsFalse($input) {
-               $this->fixture->setFieldName('myUri');
+               $this->subject->setFieldName('myUri');
                $requestHandlerMock = $this->helper->getRequestHandler(array(
                        'myUri' => $input
                ));
-               $this->fixture->injectRequestHandler($requestHandlerMock);
+               $this->subject->injectRequestHandler($requestHandlerMock);
 
                $this->assertFalse(
-                       $this->fixture->isValid()
+                       $this->subject->isValid()
                );
        }
 }
index cab43f3..dc599f4 100644 (file)
@@ -33,7 +33,7 @@ class FilesContentObjectTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
        /**
         * @var \TYPO3\CMS\Frontend\ContentObject\FilesContentObject|\PHPUnit_Framework_MockObject_MockObject
         */
-       protected $sut = NULL;
+       protected $subject = NULL;
 
        /**
         * @var \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController
@@ -56,14 +56,14 @@ class FilesContentObjectTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                $GLOBALS['TSFE']->renderCharset = 'utf-8';
 
                $contentObject = $this->getMock('TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer', array('dummy'));
-               $this->sut = $this->getMock('TYPO3\CMS\Frontend\ContentObject\FilesContentObject', array('dummy'), array($contentObject));
+               $this->subject = $this->getMock('TYPO3\CMS\Frontend\ContentObject\FilesContentObject', array('dummy'), array($contentObject));
        }
 
        /**
         * Tear down
         */
        public function tearDown() {
-               unset($this->sut, $this->tsfe);
+               unset($this->subject, $this->tsfe);
        }
 
        /**
@@ -231,9 +231,9 @@ class FilesContentObjectTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                $fileRepository->expects($this->any())
                        ->method('findFileReferenceByUid')
                        ->will($this->returnValueMap($fileReferenceMap));
-               $this->sut->setFileRepository($fileRepository);
+               $this->subject->setFileRepository($fileRepository);
 
-               $this->assertSame($expected, $this->sut->render($configuration));
+               $this->assertSame($expected, $this->subject->render($configuration));
        }
 
        /**
@@ -401,9 +401,9 @@ class FilesContentObjectTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                $fileRepository->expects($this->any())
                        ->method('findByUid')
                        ->will($this->returnValueMap($fileMap));
-               $this->sut->setFileRepository($fileRepository);
+               $this->subject->setFileRepository($fileRepository);
 
-               $this->assertSame($expected, $this->sut->render($configuration));
+               $this->assertSame($expected, $this->subject->render($configuration));
        }
 
        /**
@@ -620,9 +620,9 @@ class FilesContentObjectTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                $collectionRepository->expects($this->any())
                        ->method('findByUid')
                        ->will($this->returnValueMap($collectionMap));
-               $this->sut->setCollectionRepository($collectionRepository);
+               $this->subject->setCollectionRepository($collectionRepository);
 
-               $this->assertSame($expected, $this->sut->render($configuration));
+               $this->assertSame($expected, $this->subject->render($configuration));
        }
 
        /**
@@ -839,8 +839,8 @@ class FilesContentObjectTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                $fileFactory->expects($this->any())
                        ->method('getFolderObjectFromCombinedIdentifier')
                        ->will($this->returnValueMap($folderMap));
-               $this->sut->setFileFactory($fileFactory);
+               $this->subject->setFileFactory($fileFactory);
 
-               $this->assertSame($expected, $this->sut->render($configuration));
+               $this->assertSame($expected, $this->subject->render($configuration));
        }
 }
index 8928a01..f04acd6 100644 (file)
@@ -23,13 +23,19 @@ namespace TYPO3\CMS\Frontend\Tests\Unit\View;
  *
  *  This copyright notice MUST APPEAR in all copies of the script!
  ***************************************************************/
+
 /**
- * Testcase for TYPO3\CMS\Frontend\View\AdminPanelView
- *
- * @author Christian Kuhn <lolli@schwarzbu.ch>
+ * Test case
  */
 class AdminPanelViewTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
 
+       /**
+        * Set up
+        */
+       public function setUp() {
+               $GLOBALS['LANG'] = $this->getMock('TYPO3\\CMS\\Lang\\LanguageService', array(), array(), '', FALSE);
+       }
+
        /////////////////////////////////////////////
        // Test concerning extendAdminPanel hook
        /////////////////////////////////////////////
@@ -56,7 +62,7 @@ class AdminPanelViewTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                $GLOBALS['T3_VAR']['getUserObj'][$hookClass] = $hookMock;
                $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_adminpanel.php']['extendAdminPanel'][] = $hookClass;
                /** @var $adminPanelMock \PHPUnit_Framework_MockObject_MockObject|\TYPO3\CMS\Frontend\View\AdminPanelView */
-               $adminPanelMock = $this->getMock('TYPO3\\CMS\\Frontend\\View\\AdminPanelView', array('dummy'), array(), '', FALSE);
+               $adminPanelMock = $this->getMock('TYPO3\\CMS\\Frontend\\View\\AdminPanelView', array('extGetLL'), array(), '', FALSE);
                $hookMock->expects($this->once())->method('extendAdminPanel')->with($this->isType('string'), $this->isInstanceOf('TYPO3\\CMS\\Frontend\\View\\AdminPanelView'));
                $adminPanelMock->display();
        }
index a039fc3..c66bee3 100644 (file)
@@ -33,9 +33,10 @@ class ElementBrowserTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
         * @test
         */
        public function printCurrentUrlWithAnyTextReturnsThatText() {
-               $fixture = new \TYPO3\CMS\Recordlist\Browser\ElementBrowser();
-               $fixture->act = 'file';
-               $result = $fixture->printCurrentUrl('Teststring');
+               $GLOBALS['LANG'] = $this->getMock('TYPO3\\CMS\\Lang\\LanguageService', array(), array(), '', FALSE);
+               $subject = new \TYPO3\CMS\Recordlist\Browser\ElementBrowser();
+               $subject->act = 'file';
+               $result = $subject->printCurrentUrl('Teststring');
                $this->assertContains('Teststring', $result);
        }
 }
index f9e120b..b39abe2 100644 (file)
@@ -23,6 +23,7 @@ namespace TYPO3\CMS\Reports\Report\Status;
  *
  *  This copyright notice MUST APPEAR in all copies of the script!
  ***************************************************************/
+
 /**
  * Performs basic checks about the TYPO3 install
  *
index 38cabf1..65ee156 100644 (file)
@@ -4,7 +4,7 @@ namespace TYPO3\CMS\Reports\Tests\Unit\Report\Status;
 /***************************************************************
  *  Copyright notice
  *
- *  (c) 2013 Christian Kuhn
+ *  (c) 2013 Christian Kuhn <lolli@schwarzbu.ch>
  *  All rights reserved
  *
  *  This script is part of the TYPO3 project. The TYPO3 project is
@@ -30,6 +30,13 @@ namespace TYPO3\CMS\Reports\Tests\Unit\Report\Status;
 class Typo3StatusTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
 
        /**
+        * Set up
+        */
+       public function setUp() {
+               $GLOBALS['LANG'] = $this->getMock('TYPO3\\CMS\\Lang\\LanguageService', array(), array(), '', FALSE);
+       }
+
+       /**
         * @test
         */
        public function getStatusReturnsOldXclassStatusObjectWithSeverityOkIfNoOldXclassExists() {