[TASK] vfsStream: Use namespaced version from phpunit 34/22634/3
authorStefan Neufeind <typo3.neufeind@speedpartner.de>
Sat, 27 Jul 2013 22:18:17 +0000 (00:18 +0200)
committerWouter Wolters <typo3@wouterwolters.nl>
Sun, 28 Jul 2013 12:36:03 +0000 (14:36 +0200)
Newest phpunit introduced a namespaced version of
vfsStream together with the fix for #50230.
Although a migration-layer with the old classnames
was added, the namespaced classes should now
directly be used.

Change-Id: I1832f5690b9ea2b3f9fea5b7a1c2b39f8637f761
Resolves: #50496
Releases: 6.2
Reviewed-on: https://review.typo3.org/22634
Reviewed-by: Oliver Klee
Reviewed-by: Wouter Wolters
Tested-by: Wouter Wolters
typo3/sysext/core/Tests/Unit/Cache/Backend/FileBackendTest.php
typo3/sysext/core/Tests/Unit/Log/Writer/FileTest.php
typo3/sysext/core/Tests/Unit/Resource/BaseTestCase.php
typo3/sysext/core/Tests/Unit/Resource/Driver/LocalDriverTest.php
typo3/sysext/core/Tests/Unit/Resource/FolderTest.php
typo3/sysext/core/Tests/Unit/Utility/GeneralUtilityTest.php
typo3/sysext/fluid/Tests/Unit/View/TemplateViewTest.php

index 23777d1..cdbcad4 100644 (file)
@@ -24,6 +24,9 @@ namespace TYPO3\CMS\Core\Tests\Unit\Cache\Backend;
 *  This copyright notice MUST APPEAR in all copies of the script!
 ***************************************************************/
 
+use \org\bovigo\vfs\vfsStreamDirectory;
+use \org\bovigo\vfs\vfsStreamWrapper;
+
 /**
  * Testcase for the File cache backend
  *
@@ -40,12 +43,12 @@ class FileBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
         * @return void
         */
        public function setUp() {
-               if (!class_exists('\vfsStreamWrapper')) {
+               if (!class_exists('org\\bovigo\\vfs\\vfsStreamWrapper')) {
                        $this->markTestSkipped('File backend tests are not available with this phpunit version.');
                }
 
-               \vfsStreamWrapper::register();
-               \vfsStreamWrapper::setRoot(new \vfsStreamDirectory('Foo'));
+               vfsStreamWrapper::register();
+               vfsStreamWrapper::setRoot(new vfsStreamDirectory('Foo'));
        }
 
        /**
index 97a8807..db9d719 100644 (file)
@@ -24,6 +24,10 @@ namespace TYPO3\CMS\Core\Tests\Unit\Log\Writer;
  * This copyright notice MUST APPEAR in all copies of the script!
  ***************************************************************/
 
+use \org\bovigo\vfs\vfsStream;
+use \org\bovigo\vfs\vfsStreamDirectory;
+use \org\bovigo\vfs\vfsStreamWrapper;
+
 /**
  * Testcase for \TYPO3\CMS\Core\Log\Writer\FileWriter
  *
@@ -45,7 +49,7 @@ class FileTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                if (!class_exists('vfsStream')) {
                        $this->markTestSkipped('File backend tests are not available with this phpunit version.');
                }
-               \vfsStream::setup('LogRoot');
+               vfsStream::setup('LogRoot');
        }
 
        /**
@@ -88,7 +92,7 @@ class FileTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
         */
        public function setLogFileSetsLogFile() {
                $this->setUpVfsStream();
-               \vfsStream::newFile($this->logFileName)->at(\vfsStreamWrapper::getRoot());
+               vfsStream::newFile($this->logFileName)->at(vfsStreamWrapper::getRoot());
                $writer = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Log\\Writer\\FileWriter');
                $writer->setLogFile($this->getDefaultFileName());
                $this->assertAttributeEquals($this->getDefaultFileName(), 'logFile', $writer);
@@ -109,7 +113,7 @@ class FileTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
        public function createsLogFileDirectory() {
                $this->setUpVfsStream();
                $this->createWriter();
-               $this->assertTrue(\vfsStreamWrapper::getRoot()->hasChild($this->logFileDirectory));
+               $this->assertTrue(vfsStreamWrapper::getRoot()->hasChild($this->logFileDirectory));
        }
 
        /**
@@ -118,7 +122,7 @@ class FileTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
        public function createsLogFile() {
                $this->setUpVfsStream();
                $this->createWriter();
-               $this->assertTrue(\vfsStreamWrapper::getRoot()->getChild($this->logFileDirectory)->hasChild($this->logFileName));
+               $this->assertTrue(vfsStreamWrapper::getRoot()->getChild($this->logFileDirectory)->hasChild($this->logFileName));
        }
 
        /**
@@ -202,7 +206,7 @@ class FileTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                $this->setUpVfsStream();
                $directory = uniqid('Log');
                        // create a directory
-               \vfsStreamWrapper::getRoot()->addChild(new \vfsStreamDirectory($directory));
+               vfsStreamWrapper::getRoot()->addChild(new vfsStreamDirectory($directory));
                $logFile = 'vfs://LogRoot/' . $directory . '/' . $this->logFileName;
                $this->assertTrue(is_dir('vfs://LogRoot/' . $directory));
                $this->createWriter()->setLogFile($logFile);
index cc6d6b3..8355a56 100644 (file)
@@ -27,6 +27,8 @@ namespace TYPO3\CMS\Core\Tests\Unit\Resource;
  *  This copyright notice MUST APPEAR in all copies of the script!
  ***************************************************************/
 
+use \org\bovigo\vfs\vfsStream;
+
 /**
  * Basic test case for the \TYPO3\CMS\Core\Resource\File tests
  *
@@ -46,7 +48,7 @@ abstract class BaseTestCase extends \TYPO3\CMS\Core\Tests\UnitTestCase {
        public function setUp() {
                $this->mountDir = uniqid('mount-');
                $this->basedir = uniqid('base-');
-               \vfsStream::setup($this->basedir);
+               vfsStream::setup($this->basedir);
                // Add an entry for the mount directory to the VFS contents
                $this->vfsContents = array($this->mountDir => array());
        }
@@ -63,7 +65,7 @@ abstract class BaseTestCase extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                if (is_callable('vfsStream::create') === FALSE) {
                        $this->markTestSkipped('vfsStream::create() does not exist');
                }
-               \vfsStream::create($this->vfsContents);
+               vfsStream::create($this->vfsContents);
        }
 
        /**
@@ -83,7 +85,7 @@ abstract class BaseTestCase extends \TYPO3\CMS\Core\Tests\UnitTestCase {
         * @return string
         */
        protected function getUrlInMount($path) {
-               return \vfsStream::url($this->basedir . '/' . $this->mountDir . '/' . ltrim($path, '/'));
+               return vfsStream::url($this->basedir . '/' . $this->mountDir . '/' . ltrim($path, '/'));
        }
 
        /**
@@ -103,7 +105,7 @@ abstract class BaseTestCase extends \TYPO3\CMS\Core\Tests\UnitTestCase {
         * @return string
         */
        protected function getUrl($path) {
-               return \vfsStream::url($this->basedir . '/' . ltrim($path, '/'));
+               return vfsStream::url($this->basedir . '/' . ltrim($path, '/'));
        }
 
        /**
index fe0dd23..bf84f6f 100644 (file)
@@ -1,6 +1,5 @@
 <?php
 namespace TYPO3\CMS\Core\Tests\Unit\Resource\Driver;
-use TYPO3\CMS\Core\Utility\GeneralUtility;
 
 /***************************************************************
  *  Copyright notice
@@ -28,6 +27,10 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
  *  This copyright notice MUST APPEAR in all copies of the script!
  ***************************************************************/
 
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+use \org\bovigo\vfs\vfsStream;
+use \org\bovigo\vfs\vfsStreamWrapper;
+
 require_once dirname(dirname(__FILE__)) . '/BaseTestCase.php';
 require_once dirname(__FILE__) . '/Fixtures/LocalDriverFilenameFilter.php';
 
@@ -237,7 +240,7 @@ class LocalDriverTest extends \TYPO3\CMS\Core\Tests\Unit\Resource\BaseTestCase {
        public function driverConfigVerificationFailsIfConfiguredBasePathDoesNotExist() {
                $this->setExpectedException('TYPO3\\CMS\\Core\\Resource\\Exception\\InvalidConfigurationException', '', 1299233097);
                $driverConfiguration = array(
-                       'basePath' => \vfsStream::url($this->basedir . 'doesntexist/')
+                       'basePath' => vfsStream::url($this->basedir . 'doesntexist/')
                );
                $this->assertFalse(file_exists($driverConfiguration['basePath']));
                \TYPO3\CMS\Core\Resource\Driver\LocalDriver::verifyConfiguration($driverConfiguration);
@@ -940,7 +943,7 @@ class LocalDriverTest extends \TYPO3\CMS\Core\Tests\Unit\Resource\BaseTestCase {
                $fixture = $this->createDriverFixture(array(
                        'basePath' => $this->getMountRootUrl()
                ));
-               \vfsStream::create(array($this->basedir => array('somefile' => '')));
+               vfsStream::create(array($this->basedir => array('somefile' => '')));
                $fixture->getFolderList('somedir/');
        }
 
@@ -1118,17 +1121,17 @@ class LocalDriverTest extends \TYPO3\CMS\Core\Tests\Unit\Resource\BaseTestCase {
                }
                $data = array_merge_recursive($data, array(
                        'arbitrary group, readable/writable' => array(
-                               \vfsStream::GROUP_USER_1,
+                               vfsStream::GROUP_USER_1,
                                6,
                                array('r' => TRUE, 'w' => TRUE)
                        ),
                        'arbitrary group, readable/not writable' => array(
-                               \vfsStream::GROUP_USER_1,
+                               vfsStream::GROUP_USER_1,
                                436,
                                array('r' => TRUE, 'w' => FALSE)
                        ),
                        'arbitrary group, not readable/not writable' => array(
-                               \vfsStream::GROUP_USER_1,
+                               vfsStream::GROUP_USER_1,
                                432,
                                array('r' => FALSE, 'w' => FALSE)
                        )
@@ -1151,9 +1154,9 @@ class LocalDriverTest extends \TYPO3\CMS\Core\Tests\Unit\Resource\BaseTestCase {
                        'basePath' => $this->getMountRootUrl()
                ));
                /** @var $fileObject vfsStreamContent */
-               $fileObject = \vfsStreamWrapper::getRoot()->getChild($this->mountDir)->getChild('testfile');
+               $fileObject = vfsStreamWrapper::getRoot()->getChild($this->mountDir)->getChild('testfile');
                // just use an "arbitrary" user here - it is only important that
-               $fileObject->chown(\vfsStream::OWNER_USER_1);
+               $fileObject->chown(vfsStream::OWNER_USER_1);
                $fileObject->chgrp($group);
                $fileObject->chmod($permissions);
                $this->assertEquals($expectedResult, $fixture->getFilePermissions($this->getSimpleFileMock('/testfile')));
@@ -1567,8 +1570,8 @@ class LocalDriverTest extends \TYPO3\CMS\Core\Tests\Unit\Resource\BaseTestCase {
                        ),
                        'targetFolder' => array(),
                );
-               \vfsStream::setup($vfsBasedir);
-               \vfsStream::create($vfsStructure);
+               vfsStream::setup($vfsBasedir);
+               vfsStream::create($vfsStructure);
                /** @var \TYPO3\CMS\Core\Resource\Driver\LocalDriver|\PHPUnit_Framework_MockObject_MockObject $fixture */
                $fixture = $this->getMock('TYPO3\\CMS\\Core\\Resource\\Driver\\LocalDriver', array('getAbsolutePath'), array(), '', FALSE);
                $fixture->expects($this->at(0))
@@ -1594,8 +1597,8 @@ class LocalDriverTest extends \TYPO3\CMS\Core\Tests\Unit\Resource\BaseTestCase {
                        ),
                        'targetFolder' => array(),
                );
-               \vfsStream::setup($vfsBasedir);
-               \vfsStream::create($vfsStructure);
+               vfsStream::setup($vfsBasedir);
+               vfsStream::create($vfsStructure);
                /** @var \TYPO3\CMS\Core\Resource\Driver\LocalDriver|\PHPUnit_Framework_MockObject_MockObject $fixture */
                $fixture = $this->getMock('TYPO3\\CMS\\Core\\Resource\\Driver\\LocalDriver', array('getAbsolutePath'), array(), '', FALSE);
                $fixture->expects($this->at(0))
@@ -1623,8 +1626,8 @@ class LocalDriverTest extends \TYPO3\CMS\Core\Tests\Unit\Resource\BaseTestCase {
                        ),
                        'targetFolder' => array(),
                );
-               \vfsStream::setup($vfsBasedir);
-               \vfsStream::create($vfsStructure);
+               vfsStream::setup($vfsBasedir);
+               vfsStream::create($vfsStructure);
                /** @var \TYPO3\CMS\Core\Resource\Driver\LocalDriver|\PHPUnit_Framework_MockObject_MockObject $fixture */
                $fixture = $this->getMock('TYPO3\\CMS\\Core\\Resource\\Driver\\LocalDriver', array('getAbsolutePath'), array(), '', FALSE);
                $fixture->expects($this->at(0))
index dfd7abf..f482f93 100644 (file)
@@ -27,6 +27,8 @@ namespace TYPO3\CMS\Core\Tests\Unit\Resource;
  *  This copyright notice MUST APPEAR in all copies of the script!
  ***************************************************************/
 
+use \org\bovigo\vfs\vfsStream;
+
 /**
  * Testcase for the storage collection class of the TYPO3 FAL
  *
@@ -43,7 +45,7 @@ class FolderTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
 
        public function setUp() {
                $this->singletonInstances = \TYPO3\CMS\Core\Utility\GeneralUtility::getSingletonInstances();
-               \vfsStream::setup($this->basedir);
+               vfsStream::setup($this->basedir);
        }
 
        protected function tearDown() {
index f54d508..b0f2e5a 100644 (file)
@@ -1,6 +1,5 @@
 <?php
 namespace TYPO3\CMS\Core\Tests\Unit\Utility;
-use TYPO3\CMS\Core\Utility;
 
 /***************************************************************
  *  Copyright notice
@@ -25,6 +24,10 @@ use TYPO3\CMS\Core\Utility;
  *  This copyright notice MUST APPEAR in all copies of the script!
  ***************************************************************/
 
+use TYPO3\CMS\Core\Utility;
+use \org\bovigo\vfs\vfsStreamDirectory;
+use \org\bovigo\vfs\vfsStreamWrapper;
+
 /**
  * Testcase for class \TYPO3\CMS\Core\Utility\GeneralUtility
  *
@@ -3078,12 +3081,12 @@ class GeneralUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
         * @test
         */
        public function mkdirDeepCreatesDirectoryInVfsStream() {
-               if (!class_exists('\\vfsStreamWrapper')) {
+               if (!class_exists('org\\bovigo\\vfs\\vfsStreamWrapper')) {
                        $this->markTestSkipped('mkdirDeepCreatesDirectoryInVfsStream() test not available with this phpunit version.');
                }
-               \vfsStreamWrapper::register();
+               vfsStreamWrapper::register();
                $baseDirectory = uniqid('test_');
-               \vfsStreamWrapper::setRoot(new \vfsStreamDirectory($baseDirectory));
+               vfsStreamWrapper::setRoot(new vfsStreamDirectory($baseDirectory));
                Utility\GeneralUtility::mkdir_deep('vfs://' . $baseDirectory . '/', 'sub');
                $this->assertTrue(is_dir('vfs://' . $baseDirectory . '/sub'));
        }
index 53a0212..e35f0ec 100644 (file)
@@ -11,6 +11,9 @@ namespace TYPO3\CMS\Fluid\Tests\Unit\View;
  * The TYPO3 project - inspiring people to share!                         *
  *                                                                        */
 
+use \org\bovigo\vfs\vfsStreamDirectory;
+use \org\bovigo\vfs\vfsStreamWrapper;
+
 include_once(__DIR__ . '/Fixtures/TransparentSyntaxTreeNode.php');
 include_once(__DIR__ . '/Fixtures/TemplateViewFixture.php');
 
@@ -180,12 +183,12 @@ class TemplateViewTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
         */
        public function pathToPartialIsResolvedCorrectly() {
                $this->markTestSkipped('Needs to be finished');
-               \vfsStreamWrapper::register();
+               vfsStreamWrapper::register();
                mkdir('vfs://MyTemplates');
                \file_put_contents('vfs://MyTemplates/MyCoolAction.html', 'contentsOfMyCoolAction');
-               $mockRootDirectory = \vfsStreamDirectory::create('ExamplePackagePath/Resources/Private/Partials');
+               $mockRootDirectory = vfsStreamDirectory::create('ExamplePackagePath/Resources/Private/Partials');
                $mockRootDirectory->getChild('Resources/Private/Partials')->addChild('Partials');
-               \vfsStreamWrapper::setRoot($mockRootDirectory);
+               vfsStreamWrapper::setRoot($mockRootDirectory);
 
                $this->getAccessibleMock('TYPO3\\CMS\\Fluid\\Core\\Parser\\TemplateParser', array(''), array(), '', FALSE);
        }
@@ -194,7 +197,7 @@ class TemplateViewTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
         * @test
         */
        public function resolveTemplatePathAndFilenameChecksDifferentPathPatternsAndReturnsTheFirstPathWhichExists() {
-               \vfsStreamWrapper::register();
+               vfsStreamWrapper::register();
                mkdir('vfs://MyTemplates');
                \file_put_contents('vfs://MyTemplates/MyCoolAction.html', 'contentsOfMyCoolAction');
 
@@ -218,7 +221,7 @@ class TemplateViewTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
         * @test
         */
        public function resolveTemplatePathAndFilenameReturnsTheExplicitlyConfiguredTemplatePathAndFilename() {
-               \vfsStreamWrapper::register();
+               vfsStreamWrapper::register();
                mkdir('vfs://MyTemplates');
                \file_put_contents('vfs://MyTemplates/MyCoolAction.html', 'contentsOfMyCoolAction');