[TASK] Re-work/simplify copyright header in PHP files - Part 8
[Packages/TYPO3.CMS.git] / typo3 / sysext / extbase / Tests / Unit / Persistence / Generic / QueryFactoryTest.php
index 559b725..c0f3cb3 100644 (file)
@@ -1,36 +1,23 @@
 <?php
 namespace TYPO3\CMS\Extbase\Tests\Unit\Persistence\Generic;
 
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2012 Alexander Schnitzler <alex.schnitzler@typovision.de>
- *  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.
+/**
+ * This file is part of the TYPO3 CMS project.
  *
- *  The GNU General Public License can be found at
- *  http://www.gnu.org/copyleft/gpl.html.
+ * It is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, either version 2
+ * of the License, or any later version.
  *
- *  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.
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
  *
- *  This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
+ * The TYPO3 project - inspiring people to share!
+ */
 
 /**
- * Testcase for \TYPO3\CMS\Extbase\Persistence\Generic\QueryFactory
- *
- * @author Alexander Schnitzler <alex.schnitzler@typovision.de>
- * @author Oliver Klee <typo3-coding@oliverklee.de>
+ * Test case
  */
-class QueryFactoryTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
+class QueryFactoryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
 
        /**
         * @var string
@@ -43,11 +30,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,18 +47,11 @@ 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);
        }
 
-       protected function tearDown() {
-               unset($this->objectManager, $this->dataMapper, $this->queryFactory);
-       }
-
        public function getStaticAndRootLevelAndExpectedResult() {
                return array(
                        'Respect storage page is set when entity is neither marked as static nor as rootLevel.' => array(FALSE, FALSE, TRUE),
@@ -95,16 +70,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);
@@ -116,5 +95,3 @@ class QueryFactoryTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
                );
        }
 }
-
-?>
\ No newline at end of file