[BUGFIX] Fix incomplete mocking in ResourceStorage test
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Tests / Unit / Resource / ResourceStorageTest.php
index e531316..d162790 100644 (file)
@@ -47,6 +47,11 @@ class ResourceStorageTest extends \TYPO3\CMS\Core\Tests\Unit\Resource\BaseTestCa
                parent::setUp();
                $this->singletonInstances = \TYPO3\CMS\Core\Utility\GeneralUtility::getSingletonInstances();
                \TYPO3\CMS\Core\Utility\GeneralUtility::purgeInstances();
+               \TYPO3\CMS\Core\Utility\GeneralUtility::setSingletonInstance(
+                       'TYPO3\\CMS\\Core\\Resource\\FileRepository',
+                       $this->getMock('TYPO3\\CMS\\Core\\Resource\\FileRepository')
+               );
+
        }
 
        public function tearDown() {
@@ -90,7 +95,7 @@ class ResourceStorageTest extends \TYPO3\CMS\Core\Tests\Unit\Resource\BaseTestCa
         *
         * @param array $configuration
         * @return string
-        * @see t3lib_div::array2xml()
+        * @see \TYPO3\CMS\Core\Utility\GeneralUtility::array2xml()
         */
        protected function convertConfigurationArrayToFlexformXml(array $configuration) {
                $flexformArray = array('data' => array('sDEF' => array('lDEF' => array())));
@@ -615,6 +620,33 @@ class ResourceStorageTest extends \TYPO3\CMS\Core\Tests\Unit\Resource\BaseTestCa
                $this->fixture->replaceFile($mockedFile, PATH_site . uniqid());
        }
 
+       /**
+        * @test
+        */
+       public function getFileListHandsOverRecursiveFALSEifNotExplicitlySet() {
+               $this->prepareFixture(array());
+               $driver = $this->createDriverMock(array('basePath' => $this->getMountRootUrl()), $this->fixture, array('getFileList'));
+               $driver->expects($this->once())
+                       ->method('getFileList')
+                       ->with($this->anything(), $this->anything(), $this->anything(), $this->anything(), $this->anything(), FALSE)
+                       ->will($this->returnValue(array()));
+               $this->fixture->getFileList('/');
+       }
+
+       /**
+        * @test
+        */
+       public function getFileListHandsOverRecursiveTRUEifSet() {
+
+               $this->prepareFixture(array());
+               $driver = $this->createDriverMock(array('basePath' => $this->getMountRootUrl()), $this->fixture, array('getFileList'));
+               $driver->expects($this->once())
+                       ->method('getFileList')
+                       ->with($this->anything(), $this->anything(), $this->anything(), $this->anything(), $this->anything(), TRUE)
+                       ->will($this->returnValue(array()));
+               $this->fixture->getFileList('/', 0, 0, TRUE, TRUE, TRUE);
+       }
+
 }
 
 ?>
\ No newline at end of file