[TASK] Move StorageRepositoryTest tests to AbstractRepositoryTest 65/23765/2
authorAnja Leichsenring <aleichsenring@ab-softlab.de>
Wed, 11 Sep 2013 16:59:28 +0000 (18:59 +0200)
committerHelmut Hummel <helmut.hummel@typo3.org>
Wed, 11 Sep 2013 18:10:38 +0000 (20:10 +0200)
All tests in the class belong to AbstractRepository, so the tests move.

Change-Id: I5e78e0d61a2d8f8bcfd06d871a909b749417e616
Resolves: #51923
Releases: 6.2, 6.1, 6.0
Reviewed-on: https://review.typo3.org/23765
Reviewed-by: Helmut Hummel
Tested-by: Helmut Hummel
typo3/sysext/core/Tests/Unit/Resource/Repository/AbstractRepositoryTest.php
typo3/sysext/core/Tests/Unit/Resource/StorageRepositoryTest.php [deleted file]

index d5105e3..d3b4be2 100644 (file)
@@ -76,6 +76,50 @@ class AbstractRepositoryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                $this->fixture->findByUid('123');
        }
 
+       /**
+        * test runs on a concrete implementation of AbstractRepository
+        * to ease the pain of testing a protected method. Feel free to improve.
+        *
+        * @test
+        */
+       public function getWhereClauseForEnabledFieldsIncludesDeletedCheckInBackend() {
+               unset($GLOBALS['TSFE']);
+               $storageRepositoryMock = $this->getAccessibleMock(
+                       'TYPO3\\CMS\\Core\\Resource\\StorageRepository',
+                       array('dummy'),
+                       array(),
+                       '',
+                       FALSE
+               );
+               $result = $storageRepositoryMock->_call('getWhereClauseForEnabledFields');
+               $this->assertContains('sys_file_storage.deleted=0', $result);
+       }
+
+       /**
+        * test runs on a concrete implementation of AbstractRepository
+        * to ease the pain of testing a protected method. Feel free to improve.
+        *
+        * @test
+        */
+       public function getWhereClauseForEnabledFieldsCallsSysPageForDeletedFlagInFrontend() {
+               $GLOBALS['TSFE'] = new \stdClass();
+               $sysPageMock = $this->getMock('TYPO3\\CMS\\Frontend\\Page\\PageRepository');
+               $GLOBALS['TSFE']->sys_page = $sysPageMock;
+               $sysPageMock
+                       ->expects($this->once())
+                       ->method('deleteClause')
+                       ->with('sys_file_storage');
+               $storageRepositoryMock = $this->getAccessibleMock(
+                       'TYPO3\\CMS\\Core\\Resource\\StorageRepository',
+                       array('getEnvironmentMode'),
+                       array(),
+                       '',
+                       FALSE
+               );
+               $storageRepositoryMock->expects($this->any())->method('getEnvironmentMode')->will($this->returnValue('FE'));
+               $storageRepositoryMock->_call('getWhereClauseForEnabledFields');
+       }
+
 }
 
 ?>
\ No newline at end of file
diff --git a/typo3/sysext/core/Tests/Unit/Resource/StorageRepositoryTest.php b/typo3/sysext/core/Tests/Unit/Resource/StorageRepositoryTest.php
deleted file mode 100644 (file)
index 50346aa..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-<?php
-namespace TYPO3\CMS\Core\Tests\Unit\Resource;
-
-/***************************************************************
- * Copyright notice
- *
- * (c) 2013 Christian Kuhn <lolli@schwarzbu.ch>
- * 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!
- ***************************************************************/
-
-/**
- * Test case
- *
- * @author Christian Kuhn <lolli@schwarzbu.ch>
- */
-class StorageRepositoryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
-
-       /**
-        * @test
-        */
-       public function getWhereClauseForEnabledFieldsIncludesDeletedCheckInBackend() {
-               unset($GLOBALS['TSFE']);
-               $storageRepositoryMock = $this->getAccessibleMock(
-                       'TYPO3\\CMS\\Core\\Resource\\StorageRepository',
-                       array('dummy'),
-                       array(),
-                       '',
-                       FALSE
-               );
-               $result = $storageRepositoryMock->_call('getWhereClauseForEnabledFields');
-               $this->assertContains('sys_file_storage.deleted=0', $result);
-       }
-
-       /**
-        * @test
-        */
-       public function getWhereClauseForEnabledFieldsCallsSysPageForDeletedFlagInFrontend() {
-               $GLOBALS['TSFE'] = new \stdClass();
-               $sysPageMock = $this->getMock('TYPO3\\CMS\\Frontend\\Page\\PageRepository');
-               $GLOBALS['TSFE']->sys_page = $sysPageMock;
-               $sysPageMock
-                       ->expects($this->once())
-                       ->method('deleteClause')
-                       ->with('sys_file_storage');
-               $storageRepositoryMock = $this->getAccessibleMock(
-                       'TYPO3\\CMS\\Core\\Resource\\StorageRepository',
-                       array('getEnvironmentMode'),
-                       array(),
-                       '',
-                       FALSE
-               );
-               $storageRepositoryMock->expects($this->any())->method('getEnvironmentMode')->will($this->returnValue('FE'));
-               $storageRepositoryMock->_call('getWhereClauseForEnabledFields');
-       }
-}
-
-?>
\ No newline at end of file