[BUGFIX] Tests: Replace objectManager with mock in ext:extbase 21/28421/5
authorAnja Leichsenring <aleichsenring@ab-softlab.de>
Sat, 15 Mar 2014 15:25:22 +0000 (16:25 +0100)
committerStefan Neufeind <typo3.neufeind@speedpartner.de>
Sat, 15 Mar 2014 21:40:36 +0000 (22:40 +0100)
The usage of native objectManager in Extbase' BaseTestClass introduces
a dependency to the systems database. In order to reduce the unit test
bootstrap this dependency must be resolved.

Change-Id: I862664d4ca032d18f22b18677816bed1e1bc2a4a
Resolves: #56936
Related: #51436
Releases: 6.2
Reviewed-on: https://review.typo3.org/28421
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
Reviewed-by: Stefan Neufeind
Tested-by: Stefan Neufeind
typo3/sysext/extbase/Tests/Unit/Core/BootstrapTest.php
typo3/sysext/extbase/Tests/Unit/Hook/DataHandler/CheckFlexFormValueTest.php
typo3/sysext/extbase/Tests/Unit/Mvc/Web/Routing/UriBuilderTest.php
typo3/sysext/extbase/Tests/Unit/Persistence/Generic/Mapper/DataMapFactoryTest.php
typo3/sysext/extbase/Tests/Unit/Persistence/Generic/QueryFactoryTest.php
typo3/sysext/extbase/Tests/Unit/Persistence/Generic/QueryTest.php
typo3/sysext/extbase/Tests/Unit/Property/MapperTest.php
typo3/sysext/extbase/Tests/Unit/Reflection/ClassSchemaTest.php [new file with mode: 0644]
typo3/sysext/extbase/Tests/Unit/Reflection/ReflectionServiceTest.php
typo3/sysext/extbase/Tests/Unit/Scheduler/FieldProviderTest.php
typo3/sysext/extbase/Tests/Unit/Scheduler/TaskTest.php

index 11e587e..5f8c00f 100644 (file)
@@ -71,46 +71,13 @@ class BootstrapTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
                $configurationManagerMock = $this->getAccessibleMock('TYPO3\\CMS\\Extbase\\Configuration\\ConfigurationManager', array('getConfiguration'));
                $configurationManagerMock->expects($this->any())->method('getConfiguration')->with('Framework')->will($this->returnValue($frameworkSettings));
 
+               /** @var \TYPO3\CMS\Extbase\Object\ObjectManagerInterface|\PHPUnit_Framework_MockObject_MockObject  $objectManager */
+               $objectManager = $this->getMock('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
+
                /** @var $bootstrapMock \TYPO3\CMS\Extbase\Core\Bootstrap|\PHPUnit_Framework_MockObject_MockObject|\Tx_Phpunit_Interface_AccessibleObject */
                $bootstrapMock = $this->getAccessibleMock('TYPO3\CMS\Extbase\Core\Bootstrap', array('inject'));
-               $bootstrapMock->_set('objectManager', $this->objectManager);
+               $bootstrapMock->_set('objectManager', $objectManager);
                $bootstrapMock->_set('configurationManager', $configurationManagerMock);
                $bootstrapMock->configureObjectManager();
        }
-
-       /**
-        * @test
-        */
-       public function cliRequestHandlerIsFetchedByRequestHandlerResolver() {
-               /** @var $requestHandlerResolver \TYPO3\CMS\Extbase\Mvc\RequestHandlerResolver|\PHPUnit_Framework_MockObject_MockObject */
-               $requestHandlerResolver = $this->getMock('TYPO3\\CMS\\Extbase\\Mvc\\RequestHandlerResolver', array('resolveRequestHandler'));
-
-               /** @var $cliRequestHandler \TYPO3\CMS\Extbase\Mvc\Cli\RequestHandler|\PHPUnit_Framework_MockObject_MockObject */
-               $cliRequestHandler = $this->getAccessibleMock('TYPO3\CMS\Extbase\Mvc\Cli\RequestHandler', array('canHandleRequest'));
-               $cliRequestHandler->expects($this->any())->method('canHandleRequest')->will($this->returnValue(TRUE));
-               $cliRequestHandler->_set('objectManager', $this->objectManager);
-               $cliRequestHandler->_set('requestBuilder', $this->objectManager->get('TYPO3\CMS\Extbase\Mvc\Cli\RequestBuilder'));
-
-               /** @var \TYPO3\CMS\Extbase\Mvc\Dispatcher|\PHPUnit_Framework_MockObject_MockObject $mockDispatcher */
-               $mockDispatcher = $this->getMock('TYPO3\CMS\Extbase\Mvc\Dispatcher', array('dispatch'), array(), '', FALSE);
-               $cliRequestHandler->_set('dispatcher', $mockDispatcher);
-               /** @var $cliResponse \TYPO3\CMS\Extbase\Mvc\Cli\Response */
-               $cliResponse = $this->getMock('TYPO3\CMS\Extbase\Mvc\Cli\Response', array('send'));
-
-               /** @var $reflectionServiceMock \TYPO3\CMS\Extbase\Reflection\ReflectionService */
-               $reflectionServiceMock = $this->getMock('TYPO3\\CMS\\Extbase\\Reflection\\ReflectionService', array(), array(), '', FALSE);
-
-               /** @var $bootstrap \TYPO3\CMS\Extbase\Core\Bootstrap |\PHPUnit_Framework_MockObject_MockObject|\TYPO3\CMS\Core\Tests\AccessibleObjectInterface */
-               $bootstrap = $this->getAccessibleMock('TYPO3\CMS\Extbase\Core\Bootstrap', array('isInCliMode', 'initializeReflection', 'configureObjectManager'));
-               $bootstrap->_set('reflectionService', $reflectionServiceMock);
-               $bootstrap->expects($this->once())->method('isInCliMode')->will($this->returnValue(TRUE));
-
-               $requestHandlerResolver->expects($this->once())->method('resolveRequestHandler')->will($this->returnValue($cliRequestHandler));
-
-               \TYPO3\CMS\Core\Utility\GeneralUtility::addInstance('TYPO3\\CMS\\Extbase\\Mvc\\RequestHandlerResolver', $requestHandlerResolver);
-               \TYPO3\CMS\Core\Utility\GeneralUtility::addInstance('TYPO3\CMS\Extbase\Mvc\Cli\RequestHandler', $cliRequestHandler);
-               \TYPO3\CMS\Core\Utility\GeneralUtility::addInstance('TYPO3\CMS\Extbase\Mvc\Cli\Response', $cliResponse);
-
-               $bootstrap->run('', array());
-       }
 }
index 8451bff..80a63fe 100644 (file)
@@ -34,15 +34,6 @@ namespace TYPO3\CMS\Extbase\Tests\Unit\Hook\DataHandler;
 class CheckFlexFormValueTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
 
        /**
-        * @var \TYPO3\CMS\Core\DataHandling\DataHandler
-        */
-       protected $dataHandler;
-
-       public function setUp() {
-               $this->dataHandler = $this->objectManager->get('TYPO3\CMS\Core\DataHandling\DataHandler');
-       }
-
-       /**
         * @test
         */
        public function checkFlexFormValueBeforeMergeRemovesSwitchableControllerActions() {
@@ -67,10 +58,13 @@ class CheckFlexFormValueTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase
                        ),
                );
 
+               /** @var \TYPO3\CMS\Core\DataHandling\DataHandler $dataHandler */
+               $dataHandler = $this->getMock('TYPO3\\CMS\\Core\\DataHandling\\DataHandler');
+
                $newFlexFormDataArray = array();
                /** @var \TYPO3\CMS\Extbase\Hook\DataHandler\CheckFlexFormValue $checkFlexFormValue */
-               $checkFlexFormValue = $this->objectManager->get('TYPO3\CMS\Extbase\Hook\DataHandler\CheckFlexFormValue');
-               $checkFlexFormValue->checkFlexFormValue_beforeMerge($this->dataHandler, $currentFlexFormDataArray, $newFlexFormDataArray);
+               $checkFlexFormValue = $this->getMock('TYPO3\\CMS\\Extbase\\Hook\\DataHandler\\CheckFlexFormValue', array('dummy'));
+               $checkFlexFormValue->checkFlexFormValue_beforeMerge($dataHandler, $currentFlexFormDataArray, $newFlexFormDataArray);
 
                $this->assertSame($expectedFlexFormDataArray, $currentFlexFormDataArray);
        }
index aa0ed9f..255f2fe 100644 (file)
@@ -69,7 +69,7 @@ class UriBuilderTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
                $this->uriBuilder->_set('contentObject', $this->mockContentObject);
                $this->uriBuilder->_set('configurationManager', $this->mockConfigurationManager);
                $this->uriBuilder->_set('extensionService', $this->mockExtensionService);
-               $this->uriBuilder->_set('environmentService', $this->objectManager->get('TYPO3\\CMS\\Extbase\\Service\\EnvironmentService'));
+               $this->uriBuilder->_set('environmentService', $this->getMock('TYPO3\\CMS\\Extbase\\Service\\EnvironmentService'));
                // Mocking backend user is required for backend URI generation as BackendUtility::getModuleUrl() is called
                $backendUserMock = $this->getMock('TYPO3\\CMS\\Core\\Authentication\\BackendUserAuthentication');
                $backendUserMock->expects($this->any())->method('check')->will($this->returnValue(TRUE));
index aa84c66..6f55828 100644 (file)
@@ -398,18 +398,23 @@ class DataMapFactoryTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
                        'Tx_SampleExt_Domain_Model_LevelTwo2',
                        'Tx_SampleExt_Domain_Model_LevelOne2'
                );
+
+               /** @var \TYPO3\CMS\Extbase\Object\ObjectManagerInterface|\PHPUnit_Framework_MockObject_MockObject $objectManager */
+               $objectManager = $this->getMock('TYPO3\\CMS\\Extbase\\Object\\ObjectManager', array('dummy'));
+
                /** @var $configurationManager \TYPO3\CMS\Extbase\Configuration\ConfigurationManager|\PHPUnit_Framework_MockObject_MockObject */
                $configurationManager = $this->getMock('TYPO3\\CMS\\Extbase\\Configuration\\ConfigurationManager');
                $configurationManager->expects($this->once())->method('getConfiguration')->with('Framework')->will($this->returnValue($configuration));
+               /** @var \TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapFactory $dataMapFactory */
                $dataMapFactory = $this->getAccessibleMock('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Mapper\\DataMapFactory', array('test'));
                $dataMapFactory->_set('reflectionService', new \TYPO3\CMS\Extbase\Reflection\ReflectionService());
-               $dataMapFactory->_set('objectManager', new \TYPO3\CMS\Extbase\Object\ObjectManager());
+               $dataMapFactory->_set('objectManager', $objectManager);
                $dataMapFactory->_set('configurationManager', $configurationManager);
                $cacheMock = $this->getMock('TYPO3\\CMS\\Core\\Cache\\Frontend\\VariableFrontend', array(), array(), '', FALSE);
                $cacheMock->expects($this->any())->method('get')->will($this->returnValue(FALSE));
                $dataMapFactory->_set('dataMapCache', $cacheMock);
                $dataMap = $dataMapFactory->buildDataMap('TYPO3\\CMS\\Extbase\\Domain\\Model\\FrontendUser');
-               $this->assertSame($dataMap->getSubclasses(), $expectedSubclasses);
+               $this->assertSame($expectedSubclasses, $dataMap->getSubclasses());
        }
 
        /**
@@ -441,10 +446,16 @@ class DataMapFactoryTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
        public function createColumnMapReturnsAValidColumnMap() {
                /** @var $dataMapFactory \TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapFactory */
                $dataMapFactory = $this->getAccessibleMock('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Mapper\\DataMapFactory', array('dummy'));
-               $dataMapFactory->_set('objectManager', $this->objectManager);
+
+               /** @var \TYPO3\CMS\Extbase\Object\ObjectManagerInterface|\PHPUnit_Framework_MockObject_MockObject $objectManager */
+               $objectManager = $this->getMock('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
+               $columnMap = $this->getMock('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Mapper\\ColumnMap', array(), array('column', 'property'));
+               $objectManager->expects($this->once())->method('get')->will($this->returnValue($columnMap));
+
+               $dataMapFactory->_set('objectManager', $objectManager);
 
                $this->assertEquals(
-                       new \TYPO3\CMS\Extbase\Persistence\Generic\Mapper\ColumnMap('column', 'property'),
+                       $columnMap,
                        $dataMapFactory->_call('createColumnMap', 'column', 'property')
                );
        }
@@ -482,7 +493,6 @@ class DataMapFactoryTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
        public function setTypeDetectsTypeAndInternalTypeProperly(array $columnConfiguration, $type, $internalType) {
                /** @var $dataMapFactory \TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapFactory | AccessibleObjectInterface */
                $dataMapFactory = $this->getAccessibleMock('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Mapper\\DataMapFactory', array('dummy'));
-               $dataMapFactory->_set('objectManager', $this->objectManager);
 
                /** @var \TYPO3\CMS\Extbase\Persistence\Generic\Mapper\ColumnMap $columnMap */
                $columnMap = $this->getAccessibleMock('TYPO3\CMS\Extbase\Persistence\Generic\Mapper\ColumnMap', array('dummy'), array(), '', FALSE);
index 0d5a869..003f511 100644 (file)
@@ -43,11 +43,6 @@ class QueryFactoryTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
        protected $queryFactory = NULL;
 
        /**
-        * @var \TYPO3\CMS\Extbase\Object\ObjectManagerInterface|\PHPUnit_Framework_MockObject_MockObject
-        */
-       protected $objectManager = NULL;
-
-       /**
         * @var \TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper|\PHPUnit_Framework_MockObject_MockObject
         */
        protected $dataMapper = NULL;
@@ -65,9 +60,6 @@ class QueryFactoryTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
                        $this->getMock('TYPO3\\CMS\\Extbase\\Configuration\\ConfigurationManagerInterface')
                );
 
-               $this->objectManager = $this->getMock('TYPO3\\CMS\\Extbase\\Object\\ObjectManagerInterface');
-               $this->queryFactory->_set('objectManager', $this->objectManager);
-
                $this->dataMapper = $this->getMock('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Mapper\\DataMapper', array('getDataMap', 'convertClassNameToTableName'));
                $this->dataMapper->expects($this->any())->method('getDataMap')->will($this->returnValue($this->dataMap));
                $this->queryFactory->_set('dataMapper', $this->dataMapper);
@@ -91,16 +83,20 @@ class QueryFactoryTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
         * @test
         */
        public function createDoesNotRespectStoragePageIfStaticOrRootLevelIsTrue($static, $rootLevel, $expectedResult) {
+               /** @var \TYPO3\CMS\Extbase\Object\ObjectManagerInterface|\PHPUnit_Framework_MockObject_MockObject $objectManager */
+               $objectManager = $this->getMock('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
+               $this->queryFactory->_set('objectManager', $objectManager);
+
                $this->dataMap->expects($this->any())->method('getIsStatic')->will($this->returnValue($static));
                $this->dataMap->expects($this->any())->method('getRootLevel')->will($this->returnValue($rootLevel));
 
                $query = $this->getMock('TYPO3\\CMS\\Extbase\\Persistence\\QueryInterface');
-               $this->objectManager->expects($this->at(0))->method('get')
+               $objectManager->expects($this->at(0))->method('get')
                        ->with('TYPO3\\CMS\\Extbase\\Persistence\\QueryInterface')
                        ->will($this->returnValue($query));
 
                $querySettings = new \TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings();
-               $this->objectManager->expects($this->at(1))->method('get')
+               $objectManager->expects($this->at(1))->method('get')
                        ->with('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\QuerySettingsInterface')
                        ->will($this->returnValue($querySettings));
                $query->expects($this->once())->method('setQuerySettings')->with($querySettings);
index 2e8bd08..818b6e4 100644 (file)
@@ -37,11 +37,6 @@ class QueryTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
        protected $querySettings;
 
        /**
-        * @var \TYPO3\CMS\Extbase\Object\ObjectManagerInterface
-        */
-       protected $objectManager;
-
-       /**
         * @var \TYPO3\CMS\Extbase\Persistence\PersistenceManagerInterface
         */
        protected $persistenceManager;
@@ -62,10 +57,7 @@ class QueryTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
         * @return void
         */
        public function setUp() {
-               $this->objectManager = $this->getMock('TYPO3\\CMS\\Extbase\\Object\\ObjectManagerInterface');
-
                $this->query = $this->getAccessibleMock('TYPO3\CMS\Extbase\Persistence\Generic\Query', array('dummy'), array('someType'));
-               $this->query->_set('objectManager', $this->objectManager);
                $this->querySettings = $this->getMock('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\QuerySettingsInterface');
                $this->query->_set('querySettings', $this->querySettings);
                $this->persistenceManager = $this->getMock('TYPO3\\CMS\\Extbase\\Persistence\\PersistenceManagerInterface');
@@ -81,8 +73,11 @@ class QueryTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
         * @test
         */
        public function executeReturnsQueryResultInstanceAndInjectsItself() {
+               /** @var \TYPO3\CMS\Extbase\Object\ObjectManagerInterface|\PHPUnit_Framework_MockObject_MockObject $objectManager */
+               $objectManager = $this->getMock('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
+               $this->query->_set('objectManager', $objectManager);
                $queryResult = $this->getMock('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\QueryResult', array(), array(), '', FALSE);
-               $this->objectManager->expects($this->once())->method('get')->with('TYPO3\\CMS\\Extbase\\Persistence\\QueryResultInterface', $this->query)->will($this->returnValue($queryResult));
+               $objectManager->expects($this->once())->method('get')->with('TYPO3\\CMS\\Extbase\\Persistence\\QueryResultInterface', $this->query)->will($this->returnValue($queryResult));
                $actualResult = $this->query->execute();
                $this->assertSame($queryResult, $actualResult);
        }
@@ -162,9 +157,14 @@ class QueryTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
         * @param string $expectedOperand
         */
        public function equalsForCaseSensitiveFalseLowercasesOperand($propertyName, $operand, $expectedOperand) {
+               /** @var \TYPO3\CMS\Extbase\Object\ObjectManagerInterface|\PHPUnit_Framework_MockObject_MockObject $objectManager */
+               $objectManager = $this->getMock('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
+               /** @var \TYPO3\CMS\Extbase\Persistence\Generic\Qom\DynamicOperandInterface $dynamicOperand */
+               $dynamicOperand = $this->getMock('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Qom\\DynamicOperand');
+               $objectManager->expects($this->any())->method('get')->will($this->returnValue($dynamicOperand));
                /** @var $qomFactory \TYPO3\CMS\Extbase\Persistence\Generic\Qom\QueryObjectModelFactory */
                $qomFactory = $this->getAccessibleMock('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Qom\\QueryObjectModelFactory', array('comparison'));
-               $qomFactory->_set('objectManager', \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager'));
+               $qomFactory->_set('objectManager', $objectManager);
                $qomFactory->expects($this->once())->method('comparison')->with($this->anything(), $this->anything(), $expectedOperand);
                $this->query->_set('qomFactory', $qomFactory);
                $this->query->equals($propertyName, $operand, FALSE);
index f702f83..f47b37e 100644 (file)
@@ -34,7 +34,7 @@ class MapperTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
        /**
         * @var \TYPO3\CMS\Extbase\Property\Mapper
         */
-       protected $fixture;
+       protected $subject;
 
        /**
         * Sets up this test case
@@ -43,9 +43,6 @@ class MapperTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
         * @author Sebastian Kurf├╝rst <sebastian@typo3.org>
         */
        public function setUp() {
-               /** @var \TYPO3\CMS\Extbase\Object\ObjectManager $objectManager */
-               $objectManager = new \TYPO3\CMS\Extbase\Object\ObjectManager();
-
                /** @var \TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager $persistenceManager */
                $persistenceManager = $this->getMock('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\PersistenceManager');
 
@@ -54,48 +51,56 @@ class MapperTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
 
                /** @var \TYPO3\CMS\Extbase\Reflection\ReflectionService $reflectionService */
                $reflectionService = $this-> getAccessibleMock('TYPO3\\CMS\\Extbase\\Reflection\\ReflectionService');
-               $reflectionService->_set('objectManager', $objectManager);
 
                /** @var \TYPO3\CMS\Extbase\Validation\ValidatorResolver $validatorResolver */
                $validatorResolver = $this->getMock('TYPO3\\CMS\\Extbase\\Validation\\ValidatorResolver');
 
-               $this->fixture = $this->getAccessibleMock('TYPO3\CMS\Extbase\Property\Mapper', array('dummy'));
-               $this->fixture->_set('objectManager', $objectManager);
-               $this->fixture->_set('persistenceManager', $persistenceManager);
-               $this->fixture->_set('queryFactory', $queryFactory);
-               $this->fixture->_set('reflectionService', $reflectionService);
-               $this->fixture->_set('validatorResolver', $validatorResolver);
+               $this->subject = $this->getAccessibleMock('TYPO3\CMS\Extbase\Property\Mapper', array('dummy'));
+               $this->subject->_set('persistenceManager', $persistenceManager);
+               $this->subject->_set('queryFactory', $queryFactory);
+               $this->subject->_set('reflectionService', $reflectionService);
+               $this->subject->_set('validatorResolver', $validatorResolver);
        }
 
        /**
         * @test
         */
        public function mapReturnsObjectForNamespaceClasses() {
+               /** @var \TYPO3\CMS\Extbase\Object\ObjectManagerInterface|\PHPUnit_Framework_MockObject_MockObject $objectManager */
+               $objectManager = $this->getMock('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
+               $objectManager->expects($this->at(0))->method('get')->will($this->returnValue($this->getMock('TYPO3\\CMS\\Extbase\\Tests\\Fixture\\ClassWithGettersAndSetters')));
+               $this->subject->_set('objectManager', $objectManager);
+
                $source = array(
                        'property1' => 'foo',
                        'property2' => 'bar'
                );
 
-               $expectedObject = new \TYPO3\CMS\Extbase\Tests\Fixture\ClassWithGettersAndSetters();
+               $expectedObject = $this->getMock('TYPO3\\CMS\\Extbase\\Tests\\Fixture\\ClassWithGettersAndSetters');
                $expectedObject->setProperty1($source['property1']);
                $expectedObject->setProperty2($source['property2']);
 
-               $this->assertEquals($expectedObject, $this->fixture->map(array('property1', 'property2'), $source, 'TYPO3\\CMS\\Extbase\\Tests\\Fixture\\ClassWithGettersAndSetters'));
+               $this->assertEquals($expectedObject, $this->subject->map(array('property1', 'property2'), $source, 'TYPO3\\CMS\\Extbase\\Tests\\Fixture\\ClassWithGettersAndSetters'));
        }
 
        /**
         * @test
         */
        public function mapReturnsObjectForOldTxClasses() {
+
+               /** @var \TYPO3\CMS\Extbase\Object\ObjectManagerInterface|\PHPUnit_Framework_MockObject_MockObject $objectManager */
+               $objectManager = $this->getMock('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
+               $objectManager->expects($this->at(0))->method('get')->will($this->returnValue($this->getMock('Tx_Extbase_Tests_Fixture_TxClassWithGettersAndSetters')));
+               $this->subject->_set('objectManager', $objectManager);
                $source = array(
                        'property1' => 'foo',
                        'property2' => 'bar'
                );
 
-               $expectedObject = new \Tx_Extbase_Tests_Fixture_TxClassWithGettersAndSetters();
+               $expectedObject = $this->getMock('Tx_Extbase_Tests_Fixture_TxClassWithGettersAndSetters');
                $expectedObject->setProperty1($source['property1']);
                $expectedObject->setProperty2($source['property2']);
 
-               $this->assertEquals($expectedObject, $this->fixture->map(array('property1', 'property2'), $source, 'Tx_Extbase_Tests_Fixture_TxClassWithGettersAndSetters'));
+               $this->assertEquals($expectedObject, $this->subject->map(array('property1', 'property2'), $source, 'Tx_Extbase_Tests_Fixture_TxClassWithGettersAndSetters'));
        }
 }
diff --git a/typo3/sysext/extbase/Tests/Unit/Reflection/ClassSchemaTest.php b/typo3/sysext/extbase/Tests/Unit/Reflection/ClassSchemaTest.php
new file mode 100644 (file)
index 0000000..fedc035
--- /dev/null
@@ -0,0 +1,83 @@
+<?php
+namespace TYPO3\CMS\Extbase\Tests\Unit\Reflection;
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2013 Anja Leichsenring <anja.leichsenring@typo3.org>
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * Some tests for the class schema
+ */
+class ClassSchemaTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
+
+       /**
+        * @test
+        */
+       public function classSchemaForModelIsSetAggregateRootIfRepositoryClassIsFoundForNamespacedClasses() {
+               $className = uniqid('BazFixture');
+               eval ('
+                       namespace Foo\\Bar\\Domain\\Model;
+                       class ' . $className . ' extends \\TYPO3\\CMS\\Extbase\\DomainObject\\AbstractEntity {}
+               ');
+               eval ('
+                       namespace Foo\\Bar\\Domain\\Repository;
+                       class ' . $className . 'Repository {}
+               ');
+
+               /** @var \TYPO3\CMS\Extbase\Object\ObjectManagerInterface|\PHPUnit_Framework_MockObject_MockObject $objectManager */
+               $objectManager = $this->getMock('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
+               $mockClassSchema = $this->getAccessibleMock('TYPO3\\CMS\\Extbase\\Reflection\\ClassSchema', array('dummy'), array('Foo\\Bar\\Domain\\Model\\' . $className));
+               $mockClassSchema->_set('typeHandlingService', $this->getMock('TYPO3\\CMS\\Extbase\\Service\\TypeHandlingService'));
+               $objectManager->expects($this->once())->method('get')->will($this->returnValue($mockClassSchema));
+
+               /** @var \TYPO3\CMS\Extbase\Reflection\ReflectionService $service */
+               $service = $this->getAccessibleMock('TYPO3\\CMS\\Extbase\\Reflection\\ReflectionService', array('dummy'));
+               $service->_set('objectManager', $objectManager);
+               $classSchema = $service->getClassSchema('Foo\\Bar\\Domain\\Model\\' . $className);
+               $this->assertTrue($classSchema->isAggregateRoot());
+       }
+
+       /**
+        * @test
+        */
+       public function classSchemaForModelIsSetAggregateRootIfRepositoryClassIsFoundForNotNamespacedClasses() {
+               $className = uniqid('BazFixture');
+               eval ('
+                       class Foo_Bar_Domain_Model_' . $className . ' extends \\TYPO3\\CMS\\Extbase\\DomainObject\\AbstractEntity {}
+               ');
+               eval ('
+                       class Foo_Bar_Domain_Repository_' . $className . 'Repository {}
+               ');
+
+               /** @var \TYPO3\CMS\Extbase\Object\ObjectManagerInterface|\PHPUnit_Framework_MockObject_MockObject $objectManager */
+               $objectManager = $this->getMock('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
+               $mockClassSchema = $this->getAccessibleMock('TYPO3\\CMS\\Extbase\\Reflection\\ClassSchema', array('dummy'), array('Foo_Bar_Domain_Model_' . $className));
+               $mockClassSchema->_set('typeHandlingService', $this->getMock('TYPO3\\CMS\\Extbase\\Service\\TypeHandlingService'));
+               $objectManager->expects($this->once())->method('get')->will($this->returnValue($mockClassSchema));
+
+               $service = $this->getAccessibleMock('TYPO3\CMS\Extbase\Reflection\ReflectionService', array('dummy'));
+               $service->_set('objectManager', $objectManager);
+               $classSchema = $service->getClassSchema('Foo_Bar_Domain_Model_' . $className);
+               $this->assertTrue($classSchema->isAggregateRoot());
+       }
+
+}
index 1fe3cba..c7128cd 100644 (file)
@@ -24,7 +24,7 @@ namespace TYPO3\CMS\Extbase\Tests\Unit\Reflection;
  *  This copyright notice MUST APPEAR in all copies of the script!
  ***************************************************************/
 /**
- * Some functional tests for the backport of the reflection service
+ * Some tests for the backport of the reflection service
  */
 class ReflectionServiceTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
 
@@ -74,42 +74,4 @@ class ReflectionServiceTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
                        )
                ), $parameters);
        }
-
-       /**
-        * @test
-        */
-       public function classSchemaForModelIsSetAggregateRootIfRepositoryClassIsFoundForNamespacedClasses() {
-               $className = uniqid('BazFixture');
-               eval ('
-                       namespace Foo\\Bar\\Domain\\Model;
-                       class ' . $className . ' extends \\TYPO3\\CMS\\Extbase\\DomainObject\\AbstractEntity {}
-               ');
-               eval ('
-                       namespace Foo\\Bar\\Domain\\Repository;
-                       class ' . $className . 'Repository {}
-               ');
-
-               $service = $this->getAccessibleMock('TYPO3\CMS\Extbase\Reflection\ReflectionService', array('dummy'));
-               $service->_set('objectManager', $this->objectManager);
-               $classSchema = $service->getClassSchema('Foo\\Bar\\Domain\\Model\\' . $className);
-               $this->assertTrue($classSchema->isAggregateRoot());
-       }
-
-       /**
-        * @test
-        */
-       public function classSchemaForModelIsSetAggregateRootIfRepositoryClassIsFoundForNotNamespacedClasses() {
-               $className = uniqid('BazFixture');
-               eval ('
-                       class Foo_Bar_Domain_Model_' . $className . ' extends \\TYPO3\\CMS\\Extbase\\DomainObject\\AbstractEntity {}
-               ');
-               eval ('
-                       class Foo_Bar_Domain_Repository_' . $className . 'Repository {}
-               ');
-
-               $service = $this->getAccessibleMock('TYPO3\CMS\Extbase\Reflection\ReflectionService', array('dummy'));
-               $service->_set('objectManager', $this->objectManager);
-               $classSchema = $service->getClassSchema('Foo_Bar_Domain_Model_' . $className);
-               $this->assertTrue($classSchema->isAggregateRoot());
-       }
 }
index 354f05e..9868efa 100644 (file)
@@ -1,10 +1,6 @@
 <?php
 namespace TYPO3\CMS\Extbase\Tests\Unit\Scheduler;
 
-require_once __DIR__ . '/Fixtures/MockACommandController.php';
-require_once __DIR__ . '/Fixtures/MockBCommandController.php';
-require_once __DIR__ . '/Fixtures/MockCCommandController.php';
-
 /***************************************************************
  *  Copyright notice
  *
@@ -37,77 +33,36 @@ require_once __DIR__ . '/Fixtures/MockCCommandController.php';
 class FieldProviderTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
 
        /**
-        * @var \TYPO3\CMS\Extbase\Object\ObjectManager|\PHPUnit_Framework_MockObject_MockObject
-        */
-       protected $objectManager;
-
-       /**
-        * @var \TYPO3\CMS\Extbase\Mvc\Cli\Command|\PHPUnit_Framework_MockObject_MockObject
-        */
-       protected $command1;
-
-       /**
-        * @var \TYPO3\CMS\Extbase\Mvc\Cli\Command|\PHPUnit_Framework_MockObject_MockObject
-        */
-       protected $command2;
-
-       /**
-        * @var \TYPO3\CMS\Extbase\Mvc\Cli\Command|\PHPUnit_Framework_MockObject_MockObject
-        */
-       protected $command3;
-
-       /**
-        * @var \TYPO3\CMS\Extbase\Mvc\Cli\CommandManager|\PHPUnit_Framework_MockObject_MockObject
-        */
-       protected $commandManager;
-
-       /**
-        * @var \TYPO3\CMS\Extbase\Scheduler\FieldProvider|\PHPUnit_Framework_MockObject_MockObject|\Tx_Phpunit_Interface_AccessibleObject
-        */
-       protected $fieldProvider;
-
-       public function setUp() {
-               if (!\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('scheduler')) {
-                       $this->markTestSkipped('Tests need EXT:scheduler loaded.');
-               }
-               $this->objectManager = $this->getMock('TYPO3\CMS\Extbase\Object\ObjectManager', array('dummy'));
-               $this->commandManager = $this->getMock('TYPO3\CMS\Extbase\Mvc\Cli\CommandManager', array('getAvailableCommands'));
-
-               $this->fieldProvider = $this->getAccessibleMock(
-                       '\TYPO3\CMS\Extbase\Scheduler\FieldProvider',
-                       array('dummy'),
-                       array(),
-                       '',
-                       FALSE
-               );
-
-               $this->command1 = $this->getAccessibleMock('TYPO3\CMS\Extbase\Mvc\Cli\Command', array('isInternal'), array('TYPO3\\CMS\\Extbase\\Tests\\MockACommandController', 'FuncA'));
-               $this->command1->_set('objectManager', $this->objectManager);
-               $this->command1->_set('reflectionService', $this->objectManager->get('TYPO3\CMS\Extbase\Reflection\ReflectionService'));
-               $this->command1->expects($this->any())->method('isInternal')->will($this->returnValue(FALSE));
-
-               $this->command2 = $this->getAccessibleMock('TYPO3\CMS\Extbase\Mvc\Cli\Command', array('isInternal'), array('Acme\\Mypkg\\Command\\MockBCommandController', 'FuncB'));
-               $this->command2->_set('objectManager', $this->objectManager);
-               $this->command2->_set('reflectionService', $this->objectManager->get('TYPO3\CMS\Extbase\Reflection\ReflectionService'));
-               $this->command2->expects($this->any())->method('isInternal')->will($this->returnValue(FALSE));
-
-               $this->command3 = $this->getAccessibleMock('TYPO3\CMS\Extbase\Mvc\Cli\Command', array('isInternal'), array('Tx_Extbase_Command_MockCCommandController', 'FuncC'));
-               $this->command3->_set('objectManager', $this->objectManager);
-               $this->command3->_set('reflectionService', $this->objectManager->get('TYPO3\CMS\Extbase\Reflection\ReflectionService'));
-               $this->command3->expects($this->any())->method('isInternal')->will($this->returnValue(FALSE));
-
-               $this->commandManager->expects($this->any())->method('getAvailableCommands')->will($this->returnValue(array($this->command1, $this->command2, $this->command3)));
-
-               $this->fieldProvider->_set('objectManager', $this->objectManager);
-               $this->fieldProvider->_set('commandManager', $this->commandManager);
-               $this->fieldProvider->_set('reflectionService', $this->objectManager->get('TYPO3\\CMS\\Extbase\\Reflection\\ReflectionService'));
-       }
-
-       /**
         * @test
-        * @author Stefan Neufeind <info@speedpartner.de>
         */
        public function getCommandControllerActionFieldFetchesCorrectClassNames() {
+
+               /** @var \TYPO3\CMS\Extbase\Mvc\Cli\Command command1 */
+               $command1 = $this->getAccessibleMock('TYPO3\\CMS\\Extbase\\Mvc\\Cli\\Command', array(), array(), '', FALSE);
+               $command1->expects($this->once())->method('isInternal')->will($this->returnValue(FALSE));
+               $command1->expects($this->once())->method('getControllerClassName')->will($this->returnValue('TYPO3\\CMS\\Extbase\\Tests\\MockACommandController'));
+               $command1->expects($this->once())->method('getControllerCommandName')->will($this->returnValue('FuncA'));
+               $command1->expects($this->once())->method('getCommandIdentifier')->will($this->returnValue('extbase:mocka:funca'));
+
+               /** @var \TYPO3\CMS\Extbase\Mvc\Cli\Command command2 */
+               $command2 = $this->getAccessibleMock('TYPO3\\CMS\\Extbase\\Mvc\\Cli\\Command', array(), array(), '', FALSE);
+               $command2->expects($this->once())->method('isInternal')->will($this->returnValue(FALSE));
+               $command2->expects($this->once())->method('getControllerClassName')->will($this->returnValue('Acme\\Mypkg\\Command\\MockBCommandController'));
+               $command2->expects($this->once())->method('getControllerCommandName')->will($this->returnValue('FuncB'));
+               $command2->expects($this->once())->method('getCommandIdentifier')->will($this->returnValue('mypkg:mockb:funcb'));
+
+               /** @var \TYPO3\CMS\Extbase\Mvc\Cli\Command command3 */
+               $command3 = $this->getAccessibleMock('TYPO3\\CMS\\Extbase\\Mvc\\Cli\\Command', array(), array(), '', FALSE);
+               $command3->expects($this->once())->method('isInternal')->will($this->returnValue(FALSE));
+               $command3->expects($this->once())->method('getControllerClassName')->will($this->returnValue('Tx_Extbase_Command_MockCCommandController'));
+               $command3->expects($this->once())->method('getControllerCommandName')->will($this->returnValue('FuncC'));
+               $command3->expects($this->once())->method('getCommandIdentifier')->will($this->returnValue('extbase:mockc:funcc'));
+
+               /** @var \TYPO3\CMS\Extbase\Mvc\Cli\CommandManager|\PHPUnit_Framework_MockObject_MockObject $commandManager */
+               $commandManager = $this->getMock('TYPO3\\CMS\\Extbase\\Mvc\\Cli\\CommandManager', array('getAvailableCommands'));
+               $commandManager->expects($this->any())->method('getAvailableCommands')->will($this->returnValue(array($command1, $command2, $command3)));
+
+               /** @var \TYPO3\CMS\Extbase\Scheduler\FieldProvider|\PHPUnit_Framework_MockObject_MockObject|\Tx_Phpunit_Interface_AccessibleObject $fieldProvider */
                $fieldProvider = $this->getAccessibleMock(
                        '\TYPO3\CMS\Extbase\Scheduler\FieldProvider',
                        array('getActionLabel'),
@@ -115,9 +70,7 @@ class FieldProviderTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
                        '',
                        FALSE
                );
-               $fieldProvider->_set('objectManager', $this->objectManager);
-               $fieldProvider->_set('commandManager', $this->commandManager);
-               $fieldProvider->_set('reflectionService', $this->objectManager->get('TYPO3\\CMS\\Extbase\\Reflection\\ReflectionService'));
+               $fieldProvider->_set('commandManager', $commandManager);
                $fieldProvider->expects($this->once())->method('getActionLabel')->will($this->returnValue('some label'));
                $actualResult = $fieldProvider->_call('getCommandControllerActionField', array());
                $this->assertContains('<option title="test" value="extbase:mocka:funca">Extbase MockA: FuncA</option>', $actualResult['code']);
@@ -144,10 +97,18 @@ class FieldProviderTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
         * @author Alexander Schnitzler <alex.schnitzler@typovision.de>
         */
        public function validateAdditionalFieldsReturnsTrue() {
+               /** @var \TYPO3\CMS\Extbase\Scheduler\FieldProvider|\PHPUnit_Framework_MockObject_MockObject|\Tx_Phpunit_Interface_AccessibleObject $fieldProvider */
+               $fieldProvider = $this->getAccessibleMock(
+                       '\TYPO3\CMS\Extbase\Scheduler\FieldProvider',
+                       array('dummy'),
+                       array(),
+                       '',
+                       FALSE
+               );
                $submittedData = array();
                /** @var \TYPO3\CMS\Scheduler\Controller\SchedulerModuleController $schedulerModule */
                $schedulerModule = $this->getMock('TYPO3\\CMS\\Scheduler\\Controller\\SchedulerModuleController', array(), array(), '', FALSE);
-               $this->assertTrue($this->fieldProvider->validateAdditionalFields($submittedData, $schedulerModule));
+               $this->assertTrue($fieldProvider->validateAdditionalFields($submittedData, $schedulerModule));
        }
 
        /**
@@ -155,20 +116,51 @@ class FieldProviderTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
         * @author Alexander Schnitzler <alex.schnitzler@typovision.de>
         */
        public function getAdditionalFieldsRendersRightHtml() {
+
+               /** @var \TYPO3\CMS\Extbase\Mvc\Cli\Command command1 */
+               $command1 = $this->getAccessibleMock('TYPO3\\CMS\\Extbase\\Mvc\\Cli\\Command', array(), array(), '', FALSE);
+               $command1->expects($this->once())->method('isInternal')->will($this->returnValue(FALSE));
+               $command1->expects($this->once())->method('getControllerClassName')->will($this->returnValue('TYPO3\\CMS\\Extbase\\Tests\\MockACommandController'));
+               $command1->expects($this->once())->method('getControllerCommandName')->will($this->returnValue('FuncA'));
+               $command1->expects($this->any())->method('getCommandIdentifier')->will($this->returnValue('extbase:mocka:funca'));
+               $command1->expects($this->once())->method('getArgumentDefinitions')->will($this->returnValue(array()));
+
+               /** @var \TYPO3\CMS\Extbase\Mvc\Cli\Command command2 */
+               $command2 = $this->getAccessibleMock('TYPO3\\CMS\\Extbase\\Mvc\\Cli\\Command', array(), array(), '', FALSE);
+               $command2->expects($this->once())->method('isInternal')->will($this->returnValue(FALSE));
+               $command2->expects($this->once())->method('getControllerClassName')->will($this->returnValue('Acme\\Mypkg\\Command\\MockBCommandController'));
+               $command2->expects($this->once())->method('getControllerCommandName')->will($this->returnValue('FuncB'));
+               $command2->expects($this->any())->method('getCommandIdentifier')->will($this->returnValue('mypkg:mockb:funcb'));
+
+               /** @var \TYPO3\CMS\Extbase\Mvc\Cli\Command command3 */
+               $command3 = $this->getAccessibleMock('TYPO3\\CMS\\Extbase\\Mvc\\Cli\\Command', array(), array(), '', FALSE);
+               $command3->expects($this->once())->method('isInternal')->will($this->returnValue(FALSE));
+               $command3->expects($this->once())->method('getControllerClassName')->will($this->returnValue('Tx_Extbase_Command_MockCCommandController'));
+               $command3->expects($this->once())->method('getControllerCommandName')->will($this->returnValue('FuncC'));
+               $command3->expects($this->any())->method('getCommandIdentifier')->will($this->returnValue('extbase:mockc:funcc'));
+
+               /** @var \TYPO3\CMS\Extbase\Mvc\Cli\CommandManager|\PHPUnit_Framework_MockObject_MockObject $commandManager */
+               $commandManager = $this->getMock('TYPO3\\CMS\\Extbase\\Mvc\\Cli\\CommandManager', array('getAvailableCommands'));
+               $commandManager->expects($this->any())->method('getAvailableCommands')->will($this->returnValue(array($command1, $command2, $command3)));
+
+               /** @var \TYPO3\CMS\Extbase\Scheduler\FieldProvider|\PHPUnit_Framework_MockObject_MockObject|\Tx_Phpunit_Interface_AccessibleObject $fieldProvider */
                $fieldProvider = $this->getAccessibleMock(
                        '\TYPO3\CMS\Extbase\Scheduler\FieldProvider',
-                       array('getActionLabel', 'getArgumentLabel'),
+                       array('getActionLabel', 'getArgumentLabel', 'getCommandControllerActionArgumentFields'),
                        array(),
                        '',
                        FALSE
                );
-               $fieldProvider->_set('objectManager', $this->objectManager);
-               $fieldProvider->_set('commandManager', $this->commandManager);
-               $fieldProvider->_set('reflectionService', $this->objectManager->get('TYPO3\\CMS\\Extbase\\Reflection\\ReflectionService'));
+               $fieldProvider->_set('commandManager', $commandManager);
                $actionLabel = 'action label string';
                $argumentLabel = 'argument label string';
                $fieldProvider->expects($this->any())->method('getActionLabel')->will($this->returnValue($actionLabel));
                $fieldProvider->expects($this->any())->method('getArgumentLabel')->will($this->returnValue($argumentLabel));
+               $argArray['arg'] = array(
+                               'code' => '<input type="text" name="tx_scheduler[task_extbase][arguments][arg]" value="1" /> ',
+                               'label' => $argumentLabel
+               );
+               $fieldProvider->expects($this->any())->method('getCommandControllerActionArgumentFields')->will($this->returnValue($argArray));
                $expectedAdditionalFields = array(
                        'action' => array(
                                'code' => '<select name="tx_scheduler[task_extbase][action]">' . LF
@@ -189,8 +181,9 @@ class FieldProviderTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
                );
 
                $taskInfo = array();
+               /** @var \TYPO3\CMS\Extbase\Scheduler\Task $task */
                $task = new \TYPO3\CMS\Extbase\Scheduler\Task();
-               $task->setCommandIdentifier($this->command1->getCommandIdentifier());
+               $task->setCommandIdentifier($command1->getCommandIdentifier());
                /** @var \TYPO3\CMS\Scheduler\Controller\SchedulerModuleController $schedulerModule */
                $schedulerModule = $this->getMock('TYPO3\\CMS\\Scheduler\\Controller\\SchedulerModuleController', array(), array(), '', FALSE);
 
index 527f27a..45a2e89 100644 (file)
@@ -45,13 +45,8 @@ class TaskTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
        protected $taskExecutor;
 
        public function setUp() {
-               if (!\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('scheduler')) {
-                       $this->markTestSkipped('Tests need EXT:scheduler loaded.');
-               }
                $this->taskExecutor = $this->getMock('TYPO3\\CMS\\Extbase\\Scheduler\\TaskExecutor', array('execute'));
                $this->task = $this->getAccessibleMock('TYPO3\\CMS\\Extbase\\Scheduler\\Task', array('logException'), array(), '', FALSE);
-               $this->task->_set('objectManager', \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager'));
-               $this->task->_set('commandManager', \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Mvc\\Cli\\CommandManager'));
        }
 
        /**