[FEATURE] Use dynamic path for typo3temp/var/
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Tests / Unit / Cache / Backend / FileBackendTest.php
index a7b805c..33a1667 100644 (file)
@@ -21,15 +21,16 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
 
 /**
  * Testcase for the File cache backend
- *
- * This file is a backport from FLOW3
  */
-class FileBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
+class FileBackendTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
 {
     /**
+     * Subject is not notice free, disable E_NOTICES
+     */
+    protected static $suppressNotices = true;
+
+    /**
      * Sets up this testcase
-     *
-     * @return void
      */
     protected function setUp()
     {
@@ -52,7 +53,7 @@ class FileBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $mockCache = $this->createMock(\TYPO3\CMS\Core\Cache\Frontend\AbstractFrontend::class);
 
         $backend = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class)
-            ->setMethods(array('dummy'))
+            ->setMethods(['dummy'])
             ->disableOriginalConstructor()
             ->getMock();
         $backend->setCacheDirectory('http://localhost/');
@@ -65,7 +66,7 @@ class FileBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function setCacheDirectoryAllowsAbsolutePathWithoutTrailingSlash()
     {
-        $backend = $this->getAccessibleMock(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class, array('dummy'), array(), '', false);
+        $backend = $this->getAccessibleMock(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class, ['dummy'], [], '', false);
         $backend->_set('cacheIdentifier', 'test');
         $backend->setCacheDirectory('/tmp/foo');
         $this->assertEquals('/tmp/foo/test/', $backend->_get('temporaryCacheDirectory'));
@@ -76,7 +77,7 @@ class FileBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function setCacheDirectoryAllowsAbsolutePathWithTrailingSlash()
     {
-        $backend = $this->getAccessibleMock(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class, array('dummy'), array(), '', false);
+        $backend = $this->getAccessibleMock(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class, ['dummy'], [], '', false);
         $backend->_set('cacheIdentifier', 'test');
         $backend->setCacheDirectory('/tmp/foo/');
         $this->assertEquals('/tmp/foo/test/', $backend->_get('temporaryCacheDirectory'));
@@ -87,7 +88,7 @@ class FileBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function setCacheDirectoryAllowsRelativePathWithoutTrailingSlash()
     {
-        $backend = $this->getAccessibleMock(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class, array('dummy'), array(), '', false);
+        $backend = $this->getAccessibleMock(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class, ['dummy'], [], '', false);
         $backend->_set('cacheIdentifier', 'test');
         $backend->setCacheDirectory('tmp/foo');
         // get PATH_site without trailing slash
@@ -100,7 +101,7 @@ class FileBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function setCacheDirectoryAllowsRelativePathWithTrailingSlash()
     {
-        $backend = $this->getAccessibleMock(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class, array('dummy'), array(), '', false);
+        $backend = $this->getAccessibleMock(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class, ['dummy'], [], '', false);
         $backend->_set('cacheIdentifier', 'test');
         $backend->setCacheDirectory('tmp/foo/');
         // get PATH_site without trailing slash
@@ -113,7 +114,7 @@ class FileBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function setCacheDirectoryAllowsRelativeDottedPathWithoutTrailingSlash()
     {
-        $backend = $this->getAccessibleMock(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class, array('dummy'), array(), '', false);
+        $backend = $this->getAccessibleMock(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class, ['dummy'], [], '', false);
         $backend->_set('cacheIdentifier', 'test');
         $backend->setCacheDirectory('../tmp/foo');
         // get PATH_site without trailing slash
@@ -126,7 +127,7 @@ class FileBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function setCacheDirectoryAllowsRelativeDottedPathWithTrailingSlash()
     {
-        $backend = $this->getAccessibleMock(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class, array('dummy'), array(), '', false);
+        $backend = $this->getAccessibleMock(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class, ['dummy'], [], '', false);
         $backend->_set('cacheIdentifier', 'test');
         $backend->setCacheDirectory('../tmp/foo/');
         // get PATH_site without trailing slash
@@ -139,7 +140,7 @@ class FileBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function setCacheDirectoryAllowsAbsoluteDottedPathWithoutTrailingSlash()
     {
-        $backend = $this->getAccessibleMock(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class, array('dummy'), array(), '', false);
+        $backend = $this->getAccessibleMock(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class, ['dummy'], [], '', false);
         $backend->_set('cacheIdentifier', 'test');
         $backend->setCacheDirectory('/tmp/../foo');
         $this->assertEquals('/tmp/../foo/test/', $backend->_get('temporaryCacheDirectory'));
@@ -150,7 +151,7 @@ class FileBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function setCacheDirectoryAllowsAbsoluteDottedPathWithTrailingSlash()
     {
-        $backend = $this->getAccessibleMock(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class, array('dummy'), array(), '', false);
+        $backend = $this->getAccessibleMock(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class, ['dummy'], [], '', false);
         $backend->_set('cacheIdentifier', 'test');
         $backend->setCacheDirectory('/tmp/../foo/');
         $this->assertEquals('/tmp/../foo/test/', $backend->_get('temporaryCacheDirectory'));
@@ -165,13 +166,13 @@ class FileBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $mockCache->expects($this->any())->method('getIdentifier')->will($this->returnValue('SomeCache'));
 
         $backend = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class)
-            ->setMethods(array('dummy'))
+            ->setMethods(['dummy'])
             ->disableOriginalConstructor()
             ->getMock();
         $backend->setCacheDirectory('vfs://Foo/');
         $backend->setCache($mockCache);
 
-        $this->assertEquals('vfs://Foo/Cache/Data/SomeCache/', $backend->getCacheDirectory());
+        $this->assertEquals('vfs://Foo/cache/data/SomeCache/', $backend->getCacheDirectory());
     }
 
     /**
@@ -183,13 +184,13 @@ class FileBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $mockCache->expects($this->any())->method('getIdentifier')->will($this->returnValue('SomeCache'));
 
         $backend = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class)
-            ->setMethods(array('dummy'))
+            ->setMethods(['dummy'])
             ->disableOriginalConstructor()
             ->getMock();
         $backend->setCacheDirectory('vfs://Foo/');
         $backend->setCache($mockCache);
 
-        $this->assertEquals('vfs://Foo/Cache/Code/SomeCache/', $backend->getCacheDirectory());
+        $this->assertEquals('vfs://Foo/cache/code/SomeCache/', $backend->getCacheDirectory());
     }
 
     /**
@@ -203,13 +204,13 @@ class FileBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $mockCache = $this->createMock(\TYPO3\CMS\Core\Cache\Frontend\AbstractFrontend::class);
 
         $backend = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class)
-            ->setMethods(array('dummy'))
+            ->setMethods(['dummy'])
             ->disableOriginalConstructor()
             ->getMock();
         $backend->setCacheDirectory('vfs://Foo/');
         $backend->setCache($mockCache);
 
-        $backend->set('some identifier', array('not a string'));
+        $backend->set('some identifier', ['not a string']);
     }
 
     /**
@@ -222,10 +223,10 @@ class FileBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
         $data = 'some data' . microtime();
         $entryIdentifier = 'BackendFileTest';
-        $pathAndFilename = 'vfs://Foo/Cache/Data/UnitTestCache/' . $entryIdentifier;
+        $pathAndFilename = 'vfs://Foo/cache/data/UnitTestCache/' . $entryIdentifier;
 
         $backend = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class)
-            ->setMethods(array('dummy'))
+            ->setMethods(['dummy'])
             ->disableOriginalConstructor()
             ->getMock();
         $backend->setCacheDirectory('vfs://Foo/');
@@ -251,16 +252,16 @@ class FileBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $entryIdentifier = 'BackendFileRemoveBeforeSetTest';
 
         $backend = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class)
-            ->setMethods(array('dummy'))
+            ->setMethods(['dummy'])
             ->disableOriginalConstructor()
             ->getMock();
         $backend->setCacheDirectory('vfs://Foo/');
         $backend->setCache($mockCache);
 
-        $backend->set($entryIdentifier, $data1, array(), 500);
-        $backend->set($entryIdentifier, $data2, array(), 200);
+        $backend->set($entryIdentifier, $data1, [], 500);
+        $backend->set($entryIdentifier, $data2, [], 200);
 
-        $pathAndFilename = 'vfs://Foo/Cache/Data/UnitTestCache/' . $entryIdentifier;
+        $pathAndFilename = 'vfs://Foo/cache/data/UnitTestCache/' . $entryIdentifier;
         $this->assertFileExists($pathAndFilename);
         $retrievedData = file_get_contents($pathAndFilename, null, null, 0, strlen($data2));
         $this->assertEquals($data2, $retrievedData);
@@ -278,17 +279,23 @@ class FileBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $entryIdentifier = 'BackendFileRemoveBeforeSetTest';
 
         $backend = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class)
-            ->setMethods(array('dummy'))
+            ->setMethods(['dummy'])
             ->disableOriginalConstructor()
             ->getMock();
         $backend->setCacheDirectory('vfs://Foo/');
         $backend->setCache($mockCache);
 
-        $backend->set($entryIdentifier, $data, array('Tag1', 'Tag2'));
+        $backend->set($entryIdentifier, $data, ['Tag1', 'Tag2']);
 
-        $pathAndFilename = 'vfs://Foo/Cache/Data/UnitTestCache/' . $entryIdentifier;
+        $pathAndFilename = 'vfs://Foo/cache/data/UnitTestCache/' . $entryIdentifier;
         $this->assertFileExists($pathAndFilename);
-        $retrievedData = file_get_contents($pathAndFilename, null, null, (strlen($data) + \TYPO3\CMS\Core\Cache\Backend\FileBackend::EXPIRYTIME_LENGTH), 9);
+        $retrievedData = file_get_contents(
+            $pathAndFilename,
+            null,
+            null,
+            strlen($data) + \TYPO3\CMS\Core\Cache\Backend\FileBackend::EXPIRYTIME_LENGTH,
+            9
+        );
         $this->assertEquals('Tag1 Tag2', $retrievedData);
     }
 
@@ -304,20 +311,20 @@ class FileBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $entryIdentifier = 'BackendFileTest';
 
         $backend = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class)
-            ->setMethods(array('dummy'))
+            ->setMethods(['dummy'])
             ->disableOriginalConstructor()
             ->getMock();
         $backend->setCacheDirectory('vfs://Foo/');
         $backend->setCache($mockCache);
 
-        $backend->set($entryIdentifier, $data, array('Tag1', 'Tag2'));
+        $backend->set($entryIdentifier, $data, ['Tag1', 'Tag2']);
 
         $backend->freeze();
 
         unset($backend);
 
         $backend = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class)
-            ->setMethods(array('dummy'))
+            ->setMethods(['dummy'])
             ->disableOriginalConstructor()
             ->getMock();
         $backend->setCacheDirectory('vfs://Foo/');
@@ -336,7 +343,7 @@ class FileBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $mockCache->expects($this->atLeastOnce())->method('getIdentifier')->will($this->returnValue('UnitTestCache'));
 
         $backend = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class)
-            ->setMethods(array('setTag'))
+            ->setMethods(['setTag'])
             ->disableOriginalConstructor()
             ->getMock();
         $backend->setCacheDirectory('vfs://Foo/');
@@ -345,10 +352,10 @@ class FileBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $entryIdentifier = 'BackendFileTest';
 
         $data = 'some data' . microtime();
-        $backend->set($entryIdentifier, $data, array(), 500);
+        $backend->set($entryIdentifier, $data, [], 500);
 
         $data = 'some other data' . microtime();
-        $backend->set($entryIdentifier, $data, array(), 100);
+        $backend->set($entryIdentifier, $data, [], 100);
 
         $loadedData = $backend->get($entryIdentifier);
         $this->assertEquals($data, $loadedData);
@@ -363,10 +370,10 @@ class FileBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $mockCache->expects($this->atLeastOnce())->method('getIdentifier')->will($this->returnValue('UnitTestCache'));
 
         $backend = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class)
-            ->setMethods(array('isCacheFileExpired'))
+            ->setMethods(['isCacheFileExpired'])
             ->disableOriginalConstructor()
             ->getMock();
-        $backend->expects($this->once())->method('isCacheFileExpired')->with('vfs://Foo/Cache/Data/UnitTestCache/ExpiredEntry')->will($this->returnValue(true));
+        $backend->expects($this->once())->method('isCacheFileExpired')->with('vfs://Foo/cache/data/UnitTestCache/ExpiredEntry')->will($this->returnValue(true));
         $backend->setCacheDirectory('vfs://Foo/');
         $backend->setCache($mockCache);
 
@@ -382,7 +389,7 @@ class FileBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $mockCache->expects($this->atLeastOnce())->method('getIdentifier')->will($this->returnValue('UnitTestCache'));
 
         $backend = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class)
-            ->setMethods(array('isCacheFileExpired'))
+            ->setMethods(['isCacheFileExpired'])
             ->disableOriginalConstructor()
             ->getMock();
         $backend->setCacheDirectory('vfs://Foo/');
@@ -405,7 +412,7 @@ class FileBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $mockCache->expects($this->atLeastOnce())->method('getIdentifier')->will($this->returnValue('UnitTestCache'));
 
         $backend = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class)
-            ->setMethods(array('dummy'))
+            ->setMethods(['dummy'])
             ->disableOriginalConstructor()
             ->getMock();
         $backend->setCacheDirectory('vfs://Foo/');
@@ -426,7 +433,7 @@ class FileBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     public function hasReturnsFalseForExpiredEntries()
     {
         $backend = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class)
-            ->setMethods(array('isCacheFileExpired'))
+            ->setMethods(['isCacheFileExpired'])
             ->disableOriginalConstructor()
             ->getMock();
         $backend->expects($this->exactly(2))->method('isCacheFileExpired')->will($this->onConsecutiveCalls(true, false));
@@ -444,7 +451,7 @@ class FileBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $mockCache->expects($this->atLeastOnce())->method('getIdentifier')->will($this->returnValue('UnitTestCache'));
 
         $backend = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class)
-            ->setMethods(array('isCacheFileExpired'))
+            ->setMethods(['isCacheFileExpired'])
             ->disableOriginalConstructor()
             ->getMock();
         $backend->setCacheDirectory('vfs://Foo/');
@@ -468,10 +475,10 @@ class FileBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
         $data = 'some data' . microtime();
         $entryIdentifier = 'BackendFileTest';
-        $pathAndFilename = 'vfs://Foo/Cache/Data/UnitTestCache/' . $entryIdentifier;
+        $pathAndFilename = 'vfs://Foo/cache/data/UnitTestCache/' . $entryIdentifier;
 
         $backend = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class)
-            ->setMethods(array('dummy'))
+            ->setMethods(['dummy'])
             ->disableOriginalConstructor()
             ->getMock();
         $backend->setCacheDirectory('vfs://Foo/');
@@ -488,20 +495,20 @@ class FileBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function invalidEntryIdentifiers()
     {
-        return array(
-            'trailing slash' => array('/myIdentifer'),
-            'trailing dot and slash' => array('./myIdentifer'),
-            'trailing two dots and slash' => array('../myIdentifier'),
-            'trailing with multiple dots and slashes' => array('.././../myIdentifier'),
-            'slash in middle part' => array('my/Identifier'),
-            'dot and slash in middle part' => array('my./Identifier'),
-            'two dots and slash in middle part' => array('my../Identifier'),
-            'multiple dots and slashes in middle part' => array('my.././../Identifier'),
-            'pending slash' => array('myIdentifier/'),
-            'pending dot and slash' => array('myIdentifier./'),
-            'pending dots and slash' => array('myIdentifier../'),
-            'pending multiple dots and slashes' => array('myIdentifier.././../'),
-        );
+        return [
+            'trailing slash' => ['/myIdentifer'],
+            'trailing dot and slash' => ['./myIdentifer'],
+            'trailing two dots and slash' => ['../myIdentifier'],
+            'trailing with multiple dots and slashes' => ['.././../myIdentifier'],
+            'slash in middle part' => ['my/Identifier'],
+            'dot and slash in middle part' => ['my./Identifier'],
+            'two dots and slash in middle part' => ['my../Identifier'],
+            'multiple dots and slashes in middle part' => ['my.././../Identifier'],
+            'pending slash' => ['myIdentifier/'],
+            'pending dot and slash' => ['myIdentifier./'],
+            'pending dots and slash' => ['myIdentifier../'],
+            'pending multiple dots and slashes' => ['myIdentifier.././../'],
+        ];
     }
 
     /**
@@ -517,13 +524,13 @@ class FileBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $mockCache->expects($this->atLeastOnce())->method('getIdentifier')->will($this->returnValue('UnitTestCache'));
 
         $backend = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class)
-            ->setMethods(array('dummy'))
-            ->setConstructorArgs(array('test'))
+            ->setMethods(['dummy'])
+            ->setConstructorArgs(['test'])
             ->getMock();
         $backend->setCacheDirectory('vfs://Foo/');
         $backend->setCache($mockCache);
 
-        $backend->set($identifier, 'cache data', array());
+        $backend->set($identifier, 'cache data', []);
     }
 
     /**
@@ -539,7 +546,7 @@ class FileBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $mockCache->expects($this->atLeastOnce())->method('getIdentifier')->will($this->returnValue('UnitTestCache'));
 
         $backend = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class)
-            ->setMethods(array('dummy'))
+            ->setMethods(['dummy'])
             ->disableOriginalConstructor()
             ->getMock();
         $backend->setCacheDirectory('vfs://Foo/');
@@ -558,7 +565,7 @@ class FileBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $this->expectExceptionCode(1282073034);
 
         $backend = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class)
-            ->setMethods(array('dummy'))
+            ->setMethods(['dummy'])
             ->disableOriginalConstructor()
             ->getMock();
 
@@ -578,7 +585,7 @@ class FileBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $mockCache->expects($this->atLeastOnce())->method('getIdentifier')->will($this->returnValue('UnitTestCache'));
 
         $backend = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class)
-            ->setMethods(array('dummy'))
+            ->setMethods(['dummy'])
             ->disableOriginalConstructor()
             ->getMock();
         $backend->setCacheDirectory('vfs://Foo/');
@@ -600,7 +607,7 @@ class FileBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $mockCache->expects($this->atLeastOnce())->method('getIdentifier')->will($this->returnValue('UnitTestCache'));
 
         $backend = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class)
-            ->setMethods(array('dummy'))
+            ->setMethods(['dummy'])
             ->disableOriginalConstructor()
             ->getMock();
         $backend->setCacheDirectory('vfs://Foo/');
@@ -618,7 +625,7 @@ class FileBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $mockCache->expects($this->atLeastOnce())->method('getIdentifier')->will($this->returnValue('UnitTestCache'));
 
         $backend = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class)
-            ->setMethods(array('dummy'))
+            ->setMethods(['dummy'])
             ->disableOriginalConstructor()
             ->getMock();
         $backend->setCacheDirectory('vfs://Foo/');
@@ -642,7 +649,7 @@ class FileBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $mockCache->expects($this->atLeastOnce())->method('getIdentifier')->will($this->returnValue('UnitTestCache'));
 
         $backend = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class)
-            ->setMethods(array('isCacheFileExpired'))
+            ->setMethods(['isCacheFileExpired'])
             ->disableOriginalConstructor()
             ->getMock();
         $backend->setCacheDirectory('vfs://Foo/');
@@ -668,16 +675,16 @@ class FileBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $mockCache->expects($this->atLeastOnce())->method('getIdentifier')->will($this->returnValue('UnitTestCache'));
 
         $backend = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class)
-            ->setMethods(array('dummy'))
+            ->setMethods(['dummy'])
             ->disableOriginalConstructor()
             ->getMock();
         $backend->setCacheDirectory('vfs://Foo/');
         $backend->setCache($mockCache);
 
         $data = 'some data' . microtime();
-        $backend->set('BackendFileTest1', $data, array('UnitTestTag%test', 'UnitTestTag%boring'));
-        $backend->set('BackendFileTest2', $data, array('UnitTestTag%test', 'UnitTestTag%special'));
-        $backend->set('BackendFileTest3', $data, array('UnitTestTag%test'));
+        $backend->set('BackendFileTest1', $data, ['UnitTestTag%test', 'UnitTestTag%boring']);
+        $backend->set('BackendFileTest2', $data, ['UnitTestTag%test', 'UnitTestTag%special']);
+        $backend->set('BackendFileTest3', $data, ['UnitTestTag%test']);
 
         $expectedEntry = 'BackendFileTest2';
 
@@ -695,19 +702,19 @@ class FileBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $mockCache->expects($this->atLeastOnce())->method('getIdentifier')->will($this->returnValue('UnitTestCache'));
 
         $backend = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class)
-            ->setMethods(array('dummy'))
+            ->setMethods(['dummy'])
             ->disableOriginalConstructor()
             ->getMock();
         $backend->setCacheDirectory('vfs://Foo/');
         $backend->setCache($mockCache);
 
         $data = 'some data';
-        $backend->set('BackendFileTest1', $data, array('UnitTestTag%test', 'UnitTestTag%boring'));
-        $backend->set('BackendFileTest2', $data, array('UnitTestTag%test', 'UnitTestTag%special'), -100);
-        $backend->set('BackendFileTest3', $data, array('UnitTestTag%test'));
+        $backend->set('BackendFileTest1', $data, ['UnitTestTag%test', 'UnitTestTag%boring']);
+        $backend->set('BackendFileTest2', $data, ['UnitTestTag%test', 'UnitTestTag%special'], -100);
+        $backend->set('BackendFileTest3', $data, ['UnitTestTag%test']);
 
-        $this->assertSame(array(), $backend->findIdentifiersByTag('UnitTestTag%special'));
-        $this->assertSame(array('BackendFileTest1', 'BackendFileTest3'), $backend->findIdentifiersByTag('UnitTestTag%test'));
+        $this->assertSame([], $backend->findIdentifiersByTag('UnitTestTag%special'));
+        $this->assertSame(['BackendFileTest1', 'BackendFileTest3'], $backend->findIdentifiersByTag('UnitTestTag%test'));
     }
 
     /**
@@ -719,7 +726,7 @@ class FileBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $mockCache->expects($this->atLeastOnce())->method('getIdentifier')->will($this->returnValue('UnitTestCache'));
 
         $backend = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class)
-            ->setMethods(array('dummy'))
+            ->setMethods(['dummy'])
             ->disableOriginalConstructor()
             ->getMock();
         $backend->setCacheDirectory('vfs://Foo/');
@@ -729,13 +736,13 @@ class FileBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $backend->set('BackendFileTest1', $data);
         $backend->set('BackendFileTest2', $data);
 
-        $this->assertFileExists('vfs://Foo/Cache/Data/UnitTestCache/BackendFileTest1');
-        $this->assertFileExists('vfs://Foo/Cache/Data/UnitTestCache/BackendFileTest2');
+        $this->assertFileExists('vfs://Foo/cache/data/UnitTestCache/BackendFileTest1');
+        $this->assertFileExists('vfs://Foo/cache/data/UnitTestCache/BackendFileTest2');
 
         $backend->flush();
 
-        $this->assertFileNotExists('vfs://Foo/Cache/Data/UnitTestCache/BackendFileTest1');
-        $this->assertFileNotExists('vfs://Foo/Cache/Data/UnitTestCache/BackendFileTest2');
+        $this->assertFileNotExists('vfs://Foo/cache/data/UnitTestCache/BackendFileTest1');
+        $this->assertFileNotExists('vfs://Foo/cache/data/UnitTestCache/BackendFileTest2');
     }
 
     /**
@@ -747,14 +754,14 @@ class FileBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $mockCache->expects($this->atLeastOnce())->method('getIdentifier')->will($this->returnValue('UnitTestCache'));
 
         $backend = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class)
-            ->setMethods(array('dummy'))
+            ->setMethods(['dummy'])
             ->disableOriginalConstructor()
             ->getMock();
         $backend->setCacheDirectory('vfs://Foo/');
         $backend->setCache($mockCache);
 
         $backend->flush();
-        $this->assertFileExists('vfs://Foo/Cache/Data/UnitTestCache/');
+        $this->assertFileExists('vfs://Foo/cache/data/UnitTestCache/');
     }
 
     /**
@@ -763,11 +770,11 @@ class FileBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     public function flushByTagRemovesCacheEntriesWithSpecifiedTag()
     {
         $backend = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class)
-            ->setMethods(array('findIdentifiersByTag', 'remove'))
+            ->setMethods(['findIdentifiersByTag', 'remove'])
             ->disableOriginalConstructor()
             ->getMock();
 
-        $backend->expects($this->once())->method('findIdentifiersByTag')->with('UnitTestTag%special')->will($this->returnValue(array('foo', 'bar', 'baz')));
+        $backend->expects($this->once())->method('findIdentifiersByTag')->with('UnitTestTag%special')->will($this->returnValue(['foo', 'bar', 'baz']));
         $backend->expects($this->at(1))->method('remove')->with('foo');
         $backend->expects($this->at(2))->method('remove')->with('bar');
         $backend->expects($this->at(3))->method('remove')->with('baz');
@@ -784,7 +791,7 @@ class FileBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $mockCache->expects($this->atLeastOnce())->method('getIdentifier')->will($this->returnValue('UnitTestCache'));
 
         $backend = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class)
-            ->setMethods(array('isCacheFileExpired'))
+            ->setMethods(['isCacheFileExpired'])
             ->disableOriginalConstructor()
             ->getMock();
         $backend->expects($this->exactly(2))->method('isCacheFileExpired')->will($this->onConsecutiveCalls(true, false));
@@ -795,12 +802,12 @@ class FileBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $backend->set('BackendFileTest1', $data);
         $backend->set('BackendFileTest2', $data);
 
-        $this->assertFileExists('vfs://Foo/Cache/Data/UnitTestCache/BackendFileTest1');
-        $this->assertFileExists('vfs://Foo/Cache/Data/UnitTestCache/BackendFileTest2');
+        $this->assertFileExists('vfs://Foo/cache/data/UnitTestCache/BackendFileTest1');
+        $this->assertFileExists('vfs://Foo/cache/data/UnitTestCache/BackendFileTest2');
 
         $backend->collectGarbage();
-        $this->assertFileNotExists('vfs://Foo/Cache/Data/UnitTestCache/BackendFileTest1');
-        $this->assertFileExists('vfs://Foo/Cache/Data/UnitTestCache/BackendFileTest2');
+        $this->assertFileNotExists('vfs://Foo/cache/data/UnitTestCache/BackendFileTest1');
+        $this->assertFileExists('vfs://Foo/cache/data/UnitTestCache/BackendFileTest2');
     }
 
     /**
@@ -812,7 +819,7 @@ class FileBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $mockCache->expects($this->atLeastOnce())->method('getIdentifier')->will($this->returnValue('UnitTestCache'));
 
         $backend = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class)
-            ->setMethods(array('dummy'))
+            ->setMethods(['dummy'])
             ->disableOriginalConstructor()
             ->getMock();
         $backend->setCacheDirectory('vfs://Foo/');