[TASK] Make frontend/Tests/Unit/ContentObject/FilesContentObjectTest notice free 99/57899/4
authorWouter Wolters <typo3@wouterwolters.nl>
Tue, 14 Aug 2018 18:18:21 +0000 (20:18 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Tue, 14 Aug 2018 19:01:15 +0000 (21:01 +0200)
Resolves: #85850
Releases: master
Change-Id: I6f0b7fbe5a59cebd382e2c5c0cb761d3e561f0c4
Reviewed-on: https://review.typo3.org/57899
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/frontend/Classes/ContentObject/FilesContentObject.php
typo3/sysext/frontend/Tests/Unit/ContentObject/FilesContentObjectTest.php

index 59b0927..0772bb7 100644 (file)
@@ -84,7 +84,7 @@ class FilesContentObject extends AbstractContentObject
         // so e.g. stdWrap is not working on the last current file applied, thus avoiding side-effects
         $this->cObj->setCurrentFile($originalFileInContentObject);
 
-        return $this->cObj->stdWrap($content, $conf['stdWrap.']);
+        return $this->cObj->stdWrap($content, $conf['stdWrap.'] ?? []);
     }
 
     /**
@@ -99,7 +99,7 @@ class FilesContentObject extends AbstractContentObject
         $fileCollector = $this->getFileCollector();
 
         // Getting the files
-        if ($conf['references'] || $conf['references.']) {
+        if ((isset($conf['references']) && $conf['references']) || (isset($conf['references.']) && $conf['references.'])) {
             /*
             The TypoScript could look like this:
             # all items related to the page.media field:
@@ -120,7 +120,7 @@ class FilesContentObject extends AbstractContentObject
             }
         }
 
-        if ($conf['files'] || $conf['files.']) {
+        if ((isset($conf['files']) && $conf['files']) || (isset($conf['files.']) && $conf['files.'])) {
             /*
             The TypoScript could look like this:
             # with sys_file UIDs:
@@ -131,19 +131,19 @@ class FilesContentObject extends AbstractContentObject
             $fileCollector->addFiles($fileUids);
         }
 
-        if ($conf['collections'] || $conf['collections.']) {
+        if ((isset($conf['collections']) && $conf['collections']) || (isset($conf['collections.']) && $conf['collections.'])) {
             $collectionUids = GeneralUtility::intExplode(',', $this->cObj->stdWrapValue('collections', $conf), true);
             $fileCollector->addFilesFromFileCollections($collectionUids);
         }
 
-        if ($conf['folders'] || $conf['folders.']) {
+        if ((isset($conf['folders']) && $conf['folders']) || (isset($conf['folders.']) && $conf['folders.'])) {
             $folderIdentifiers = GeneralUtility::trimExplode(',', $this->cObj->stdWrapValue('folders', $conf));
             $fileCollector->addFilesFromFolders($folderIdentifiers, !empty($conf['folders.']['recursive']));
         }
 
         // Enable sorting for multiple fileObjects
         $sortingProperty = '';
-        if ($conf['sorting'] || $conf['sorting.']) {
+        if ((isset($conf['sorting']) && $conf['sorting']) || (isset($conf['sorting.']) && $conf['sorting.'])) {
             $sortingProperty = $this->cObj->stdWrapValue('sorting', $conf);
         }
         if ($sortingProperty !== '') {
index b2bbcdc..b5020d0 100644 (file)
@@ -1,4 +1,5 @@
 <?php
+declare(strict_types = 1);
 namespace TYPO3\CMS\Frontend\Tests\Unit\ContentObject;
 
 /*
@@ -33,10 +34,6 @@ use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
  */
 class FilesContentObjectTest extends UnitTestCase
 {
-    /**
-     * Subject is not notice free, disable E_NOTICES
-     */
-    protected static $suppressNotices = true;
 
     /**
      * @var bool Reset singletons created by subject
@@ -53,6 +50,7 @@ class FilesContentObjectTest extends UnitTestCase
      */
     protected function setUp()
     {
+        $GLOBALS['SIM_ACCESS_TIME'] = 0;
         $templateService = $this->getMockBuilder(TemplateService::class)
             ->setMethods(['getFileName', 'linkData'])
             ->getMock();