[BUGFIX] Create required directories in test bootstrap 16/31216/8
authorSebastian Bergmann <sebastian@php.net>
Sun, 29 Jun 2014 10:07:05 +0000 (12:07 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Sun, 29 Jun 2014 11:44:52 +0000 (13:44 +0200)
When running the core unit tests without setting up TYPO3
using the normal installation procedure then the uploads,
typo3temp, and typo3conf/ext directories do not exist.

Resolves: #59977
Releases: 6.3,6.2
Change-Id: Ib6b8ecd480b83cf818f54d865a4ff61fe62d2893
Reviewed-on: https://review.typo3.org/31216
Reviewed-by: Oliver Klee
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
.travis.yml
typo3/sysext/core/Build/UnitTestsBootstrap.php

index 71979cd..364c730 100644 (file)
@@ -36,7 +36,6 @@ before_script:
   - sudo apt-get install parallel
   - composer self-update
   - composer --dev install
-  - mkdir -p uploads typo3temp typo3conf/ext
 
 script:
   - >
@@ -58,4 +57,4 @@ script:
             grep -v \"No syntax errors detected in\" /tmp/errors;
             exit 99;
         fi
-    "
\ No newline at end of file
+    "
index d7b1476..51f21de 100644 (file)
@@ -76,6 +76,10 @@ $_SERVER['SCRIPT_NAME'] = PATH_thisScript;
 
 putenv('TYPO3_CONTEXT=Testing');
 
+createDirectory(PATH_site . 'uploads');
+createDirectory(PATH_site . 'typo3temp');
+createDirectory(PATH_site . 'typo3conf/ext');
+
 require PATH_site . '/typo3/sysext/core/Classes/Core/Bootstrap.php';
 
 \TYPO3\CMS\Core\Core\Bootstrap::getInstance()
@@ -94,3 +98,23 @@ $GLOBALS['TYPO3_CONF_VARS']['SYS']['trustedHostsPattern'] = '.*';
        ->initializeCachingFramework()
        ->initializeClassLoaderCaches()
        ->initializePackageManagement('TYPO3\\CMS\\Core\\Package\\UnitTestPackageManager');
+
+/**
+ * Creates directory (recursively if required).
+ *
+ * @param  string $directory path of the directory to be created
+ * @return void
+ * @throws \RuntimeException
+ */
+function createDirectory($directory) {
+       if (is_dir($directory)) {
+               return;
+       }
+
+       if (!mkdir($directory, 0777, TRUE)) {
+               throw new \RuntimeException(
+                       'Directory "' . $directory . '" could not be created',
+                       1404038665
+               );
+       }
+}