diff --git a/typo3/sysext/core/Classes/Resource/Driver/LocalDriver.php b/typo3/sysext/core/Classes/Resource/Driver/LocalDriver.php index bffb6df095a5e614a5d5855e50d305775f16dd62..e90eabcca543cb6def722a83469fe5cb55ac0e5c 100644 --- a/typo3/sysext/core/Classes/Resource/Driver/LocalDriver.php +++ b/typo3/sysext/core/Classes/Resource/Driver/LocalDriver.php @@ -115,11 +115,15 @@ class LocalDriver extends \TYPO3\CMS\Core\Resource\Driver\AbstractDriver { /** * Calculates the absolute path to this drivers storage location. * - * @throws \RuntimeException + * @throws \TYPO3\CMS\Core\Resource\Exception\InvalidConfigurationException * @param array $configuration * @return string */ protected function calculateBasePath(array $configuration) { + if (!array_key_exists('basePath', $configuration) || empty($configuration['basePath'])) { + throw new \TYPO3\CMS\Core\Resource\Exception\InvalidConfigurationException('Configuration must contain base path.', 1346510477); + } + if ($configuration['pathType'] === 'relative') { $relativeBasePath = $configuration['basePath']; $absoluteBasePath = PATH_site . $relativeBasePath; diff --git a/typo3/sysext/core/Tests/Unit/Resource/Driver/LocalDriverTest.php b/typo3/sysext/core/Tests/Unit/Resource/Driver/LocalDriverTest.php index fdfdd5c669beb893c6dcd73259ced26301d4324e..4471ae11712ff7505876c10c6ce72901a2420b07 100644 --- a/typo3/sysext/core/Tests/Unit/Resource/Driver/LocalDriverTest.php +++ b/typo3/sysext/core/Tests/Unit/Resource/Driver/LocalDriverTest.php @@ -131,7 +131,7 @@ class LocalDriverTest extends \TYPO3\CMS\Core\Tests\Unit\Resource\BaseTestCase { */ public function rootLevelFolderIsCreatedWithCorrectArguments() { $mockedMount = $this->getMock('TYPO3\\CMS\\Core\\Resource\\ResourceStorage', array(), array(), '', FALSE); - $fixture = $this->createDriverFixture(array(), $mockedMount); + $fixture = $this->createDriverFixture(array('basePath' => $this->getMountRootUrl()), $mockedMount); $mockedFactory = $this->getMock('TYPO3\\CMS\\Core\\Resource\\ResourceFactory'); $mockedFactory->expects($this->once())->method('createFolderObject')->with($this->equalTo($mockedMount), $this->equalTo('/'), $this->equalTo('')); \TYPO3\CMS\Core\Utility\GeneralUtility::setSingletonInstance('TYPO3\\CMS\\Core\\Resource\\ResourceFactory', $mockedFactory); diff --git a/typo3/sysext/core/Tests/Unit/Resource/ResourceStorageTest.php b/typo3/sysext/core/Tests/Unit/Resource/ResourceStorageTest.php index fd46ff767cf56be6273b265e0b61fdac20a0db4f..d916fc9ec88990723da34cd0fad6115a34d1b0af 100644 --- a/typo3/sysext/core/Tests/Unit/Resource/ResourceStorageTest.php +++ b/typo3/sysext/core/Tests/Unit/Resource/ResourceStorageTest.php @@ -118,6 +118,11 @@ class ResourceStorageTest extends \TYPO3\CMS\Core\Tests\Unit\Resource\BaseTestCa if ($storageObject == NULL) { $storageObject = $this->getMock('TYPO3\\CMS\\Core\\Resource\\ResourceStorage', array(), array(), '', FALSE); } + + if (!isset($driverConfiguration['basePath'])) { + $driverConfiguration['basePath'] = $this->getMountRootUrl(); + } + if ($mockedDriverMethods === NULL) { $driver = new \TYPO3\CMS\Core\Resource\Driver\LocalDriver($driverConfiguration); } else {