[!!!][TASK] Merge typo3/sysext/core/Build/ to Build/ directory 47/39647/4
authorChristian Kuhn <lolli@schwarzbu.ch>
Wed, 20 May 2015 11:52:28 +0000 (13:52 +0200)
committerAndreas Fernandez <typo3@scripting-base.de>
Thu, 21 May 2015 10:24:41 +0000 (12:24 +0200)
With the grunt integration a Build/ directory on repository root
level was introduced. Out test infrastructure currently relies
on a second Build/ folder located in typo3/sysext/core/.
The patch moves all files from the core Build directory to the
new global one and adapts paths.
As benefit, paths are shorter and easier to find and remember now.

This patch is breaking for test environments and extensions that
rely on the recommended core test infrastructure for unit and
functional tests.

A typical test run now should look like:

bin/phpunit -c Build/UnitTests.xml

Change-Id: I9d87a566835f5849ce1e0e22d922d24c4b46ff31
Releases: master
Resolves: #67076
Reviewed-on: http://review.typo3.org/39647
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
Reviewed-by: Mathias Brodala <mbrodala@pagemachine.de>
Tested-by: Mathias Brodala <mbrodala@pagemachine.de>
Reviewed-by: Andreas Fernandez <typo3@scripting-base.de>
Tested-by: Andreas Fernandez <typo3@scripting-base.de>
16 files changed:
.travis.yml
Build/Configuration/FunctionalTestsConfiguration.php [new file with mode: 0644]
Build/FunctionalTests.xml [new file with mode: 0644]
Build/FunctionalTestsBootstrap.php [new file with mode: 0644]
Build/Scripts/xlfcheck.sh [new file with mode: 0755]
Build/UnitTests.xml [new file with mode: 0644]
Build/UnitTestsBootstrap.php [new file with mode: 0644]
typo3/sysext/core/Build/Configuration/FunctionalTestsConfiguration.php [deleted file]
typo3/sysext/core/Build/FunctionalTests.xml [deleted file]
typo3/sysext/core/Build/FunctionalTestsBootstrap.php [deleted file]
typo3/sysext/core/Build/Scripts/xlfcheck.sh [deleted file]
typo3/sysext/core/Build/UnitTests.xml [deleted file]
typo3/sysext/core/Build/UnitTestsBootstrap.php [deleted file]
typo3/sysext/core/Documentation/Changelog/master/Breaking-67076-CoreBuildFolderMovedToTopLevel.rst [new file with mode: 0644]
typo3/sysext/core/Tests/FunctionalTestCase.php
typo3/sysext/core/Tests/FunctionalTestCaseBootstrapUtility.php

index ba9dfa2..cb242c6 100644 (file)
@@ -42,7 +42,7 @@ script:
     if [[ "$UNIT_TESTS" == "yes" ]]; then
       echo;
       echo "Running unit tests";
-      ./bin/phpunit --colors -c typo3/sysext/core/Build/UnitTests.xml
+      bin/phpunit --colors -c Build/UnitTests.xml
     fi
   - >
     if [[ "$FUNCTIONAL_TESTS" == "yes" ]]; then
@@ -51,7 +51,7 @@ script:
         export typo3DatabaseHost="localhost";
         export typo3DatabaseUsername="root";
         export typo3DatabasePassword="";
-        find . -wholename '*typo3/sysext/*/Tests/Functional/*Test.php' | parallel --gnu 'echo; echo "Running functional test suite {}"; ./bin/phpunit --colors -c typo3/sysext/core/Build/FunctionalTests.xml {}'
+        find . -wholename '*typo3/sysext/*/Tests/Functional/*Test.php' | parallel --gnu 'echo; echo "Running functional test suite {}"; bin/phpunit --colors -c Build/FunctionalTests.xml {}'
     fi
   - >
     if [[ "$PHP_LINT" == "yes" ]]; then
@@ -63,7 +63,7 @@ script:
     if [[ "$XLF_CHECK" == "yes" ]]; then
         echo;
         echo "Running XLF checker";
-        ./typo3/sysext/core/Build/Scripts/xlfcheck.sh
+        Build/Scripts/xlfcheck.sh
     fi
   - >
       if [[ "$SUBMODULE_TEST" == "yes" ]]; then
diff --git a/Build/Configuration/FunctionalTestsConfiguration.php b/Build/Configuration/FunctionalTestsConfiguration.php
new file mode 100644 (file)
index 0000000..4c6b760
--- /dev/null
@@ -0,0 +1,8 @@
+<?php
+return array(
+       'SYS' => array(
+               'displayErrors' => '1',
+               'debugExceptionHandler' => '',
+               'trustedHostsPattern' => '.*',
+       )
+);
diff --git a/Build/FunctionalTests.xml b/Build/FunctionalTests.xml
new file mode 100644 (file)
index 0000000..d4d5a1e
--- /dev/null
@@ -0,0 +1,30 @@
+<!--
+       Functional test suites setup
+
+       Functional tests should extend from \TYPO3\CMS\Core\Tests\FunctionalTestCase,
+       take a look at this class for further documentation on how to run the suite.
+
+       TYPO3 CMS functional test suite also needs phpunit bootstrap code, the
+       file is located next to this .xml as FunctionalTestsBootstrap.php
+-->
+<phpunit
+       backupGlobals="true"
+       backupStaticAttributes="false"
+       bootstrap="FunctionalTestsBootstrap.php"
+       colors="false"
+       convertErrorsToExceptions="true"
+       convertWarningsToExceptions="true"
+       forceCoversAnnotation="false"
+       processIsolation="true"
+       stopOnError="false"
+       stopOnFailure="false"
+       stopOnIncomplete="false"
+       stopOnSkipped="false"
+       verbose="false"
+>
+       <testsuites>
+               <testsuite name="Core tests">
+                       <directory>../typo3/sysext/*/Tests/Functional/</directory>
+               </testsuite>
+       </testsuites>
+</phpunit>
diff --git a/Build/FunctionalTestsBootstrap.php b/Build/FunctionalTestsBootstrap.php
new file mode 100644 (file)
index 0000000..3bb1af9
--- /dev/null
@@ -0,0 +1,128 @@
+<?php
+namespace TYPO3\CMS\Core\Build;
+
+/*
+ * This file is part of the TYPO3 CMS project.
+ *
+ * It is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, either version 2
+ * of the License, or any later version.
+ *
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ *
+ * The TYPO3 project - inspiring people to share!
+ */
+
+/**
+ * This file is defined in FunctionalTests.xml and called by phpunit
+ * before instantiating the test suites, it must also be included
+ * with phpunit parameter --bootstrap if executing single test case classes.
+ */
+class FunctionalTestsBootstrap {
+       /**
+        * Bootstraps the system for unit tests.
+        *
+        * @return void
+        */
+       public function bootstrapSystem() {
+               $this->enableDisplayErrors()
+                       ->loadClassFiles()
+                       ->defineOriginalRootPath()
+                       ->createNecessaryDirectoriesInDocumentRoot();
+       }
+
+       /**
+        * Makes sure error messages during the tests get displayed no matter what is set in php.ini.
+        *
+        * @return FunctionalTestsBootstrap fluent interface
+        */
+       protected function enableDisplayErrors() {
+               @ini_set('display_errors', 1);
+               return $this;
+       }
+
+       /**
+        * Requires classes the functional test classes extend from or use for further bootstrap.
+        * Only files required for "new TestCaseClass" are required here and a general exception
+        * that is thrown by setUp() code.
+        *
+        * @return FunctionalTestsBootstrap fluent interface
+        */
+       protected function loadClassFiles() {
+               $testsDirectory = __DIR__ . '/../typo3/sysext/core/Tests/';
+               require_once($testsDirectory . 'BaseTestCase.php');
+               require_once($testsDirectory . 'FunctionalTestCase.php');
+               require_once($testsDirectory . 'FunctionalTestCaseBootstrapUtility.php');
+               require_once($testsDirectory . 'Exception.php');
+
+               return $this;
+       }
+
+       /**
+        * Defines the constant ORIGINAL_ROOT for the path to the original TYPO3 document root.
+        *
+        * If ORIGINAL_ROOT already is defined, this method is a no-op.
+        *
+        * @return FunctionalTestsBootstrap fluent interface
+        */
+       protected function defineOriginalRootPath() {
+               if (!defined('ORIGINAL_ROOT')) {
+                       /** @var string */
+                       define('ORIGINAL_ROOT', $this->getWebRoot());
+               }
+
+               return $this;
+       }
+
+       /**
+        * Creates the following directories in the TYPO3 core:
+        * - typo3temp
+        *
+        * @return FunctionalTestsBootstrap fluent interface
+        */
+       protected function createNecessaryDirectoriesInDocumentRoot() {
+               $this->createDirectory(ORIGINAL_ROOT . 'typo3temp');
+
+               return $this;
+       }
+
+       /**
+        * Creates the directory $directory (recursively if required).
+        *
+        * If $directory already exists, this method is a no-op.
+        *
+        * @param string $directory absolute path of the directory to be created
+        * @return void
+        * @throws \RuntimeException
+        */
+       protected function createDirectory($directory) {
+               if (is_dir($directory)) {
+                       return;
+               }
+               @mkdir($directory, 0777, TRUE);
+               clearstatcache();
+               if (!is_dir($directory)) {
+                       throw new \RuntimeException('Directory "' . $directory . '" could not be created', 1404038665);
+               }
+       }
+
+       /**
+        * Returns the absolute path the TYPO3 document root.
+        *
+        * @return string the TYPO3 document root using Unix path separators
+        */
+       protected function getWebRoot() {
+               if (getenv('TYPO3_PATH_WEB')) {
+                       $webRoot = getenv('TYPO3_PATH_WEB') . '/';
+               } else {
+                       $webRoot = getcwd() . '/';
+               }
+
+               return strtr($webRoot, '\\', '/');
+       }
+}
+
+$bootstrap = new FunctionalTestsBootstrap();
+$bootstrap->bootstrapSystem();
+unset($bootstrap);
diff --git a/Build/Scripts/xlfcheck.sh b/Build/Scripts/xlfcheck.sh
new file mode 100755 (executable)
index 0000000..fd3c5ce
--- /dev/null
@@ -0,0 +1,36 @@
+#!/bin/bash
+
+#########################
+#
+# Find all t3:id numbers in XLF language files
+# and check their uniqueness.
+#
+# @author Markus Klein <klein.t3@reelworx.at>
+# @date 2014-11-14
+#
+##########################
+
+function join { local IFS="$1"; shift; echo "$*"; }
+
+find typo3 -name '*.xlf' > xlffiles.txt
+sed -ne 's/.*t3:id="\([0-9]\+\)".*/\1/pgM' `cat xlffiles.txt` | sort > xlfids.txt
+uniq xlfids.txt > uxlfids.txt
+XLFCNT=$(cat xlffiles.txt | wc -l)
+XLFIDCNT=$(cat xlfids.txt | wc -l)
+UXLFIDCNT=$(cat uxlfids.txt | wc -l)
+DIFFIDS=$(join , $(uniq -d xlfids.txt))
+MISSINGIDS=$(join , $(grep -LP 't3:id' `cat xlffiles.txt`))
+rm xlfids.txt uxlfids.txt xlffiles.txt
+if [ $XLFCNT -ne $XLFIDCNT ];
+then
+       echo "There is at least one XLF file missing a unique ID (t3:id)."
+       echo "Missing in: $MISSINGIDS"
+       exit 1
+fi
+if [ $XLFIDCNT -ne $UXLFIDCNT ];
+then
+       echo "There is an XLF id that does not seem to be UNIQUE."
+       echo "Search for t3:id $DIFFIDS"
+       exit 1
+fi
+exit 0
diff --git a/Build/UnitTests.xml b/Build/UnitTests.xml
new file mode 100644 (file)
index 0000000..a5abb56
--- /dev/null
@@ -0,0 +1,27 @@
+<phpunit
+       backupGlobals="true"
+       backupStaticAttributes="false"
+       bootstrap="UnitTestsBootstrap.php"
+       colors="false"
+       convertErrorsToExceptions="true"
+       convertWarningsToExceptions="true"
+       forceCoversAnnotation="false"
+       processIsolation="false"
+       stopOnError="false"
+       stopOnFailure="false"
+       stopOnIncomplete="false"
+       stopOnSkipped="false"
+       verbose="false"
+>
+       <testsuites>
+               <testsuite name="Core tests">
+                       <directory>../typo3/sysext/*/Tests/Unit/</directory>
+               </testsuite>
+               <testsuite name="Core legacy tests">
+                       <directory>../typo3/sysext/core/Tests/Legacy/</directory>
+               </testsuite>
+               <testsuite name="Suite integrity tests">
+                       <directory>../typo3/sysext/core/Tests/Integrity/</directory>
+               </testsuite>
+       </testsuites>
+</phpunit>
diff --git a/Build/UnitTestsBootstrap.php b/Build/UnitTestsBootstrap.php
new file mode 100644 (file)
index 0000000..eed5662
--- /dev/null
@@ -0,0 +1,216 @@
+<?php
+namespace TYPO3\CMS\Core\Build;
+
+/*
+ * This file is part of the TYPO3 CMS project.
+ *
+ * It is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, either version 2
+ * of the License, or any later version.
+ *
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ *
+ * The TYPO3 project - inspiring people to share!
+ */
+
+use TYPO3\CMS\Core\Core\Bootstrap;
+
+/**
+ * This file is defined in UnitTests.xml and called by phpunit
+ * before instantiating the test suites, it must also be included
+ * with phpunit parameter --bootstrap if executing single test case classes.
+ *
+ * For easy access to the PHPUnit and VFS framework, it is recommended to install the phpunit TYPO3 Extension
+ * It does not need to be activated, nor a cli user needs to be present.
+ * But it is also possible to use other installations of PHPUnit and VFS
+ *
+ *  * Call whole unit test suite, example:
+ * - cd /var/www/t3master/foo  # Document root of TYPO3 CMS instance (location of index.php)
+ * - bin/phpunit -c Build/UnitTests.xml
+ *
+ * Call single test case, example:
+ * - cd /var/www/t3master/foo  # Document root of TYPO3 CMS instance (location of index.php)
+ * - bin/phpunit \
+ *     --bootstrap Build/UnitTestsBootstrap.php \
+ *     typo3/sysext/core/Tests/Unit/DataHandling/DataHandlerTest.php
+ */
+class UnitTestsBootstrap {
+
+       /**
+        * Bootstraps the system for unit tests.
+        *
+        * @return void
+        */
+       public function bootstrapSystem() {
+               $this->enableDisplayErrors()
+                       ->checkForCliDispatch()
+                       ->defineSitePath()
+                       ->setTypo3Context()
+                       ->createNecessaryDirectoriesInDocumentRoot()
+                       ->includeAndStartCoreBootstrap()
+                       ->initializeConfiguration()
+                       ->finishCoreBootstrap();
+       }
+
+       /**
+        * Makes sure error messages during the tests get displayed no matter what is set in php.ini.
+        *
+        * @return UnitTestsBootstrap fluent interface
+        */
+       protected function enableDisplayErrors() {
+               @ini_set('display_errors', 1);
+               return $this;
+       }
+
+       /**
+        * Checks whether the tests are run using the CLI dispatcher. If so, echos a helpful message and exits with
+        * an error code 1.
+        *
+        * @return UnitTestsBootstrap fluent interface
+        */
+       protected function checkForCliDispatch() {
+               if (!defined('TYPO3_MODE')) {
+                       return $this;
+               }
+
+               array_shift($_SERVER['argv']);
+               $flatArguments = implode(' ', $_SERVER['argv']);
+               echo 'Please run the unit tests using the following command:' . chr(10) .
+                       sprintf('bin/phpunit %s', $flatArguments) . chr(10) .
+                       chr(10);
+
+               exit(1);
+       }
+
+       /**
+        * Defines the PATH_site and PATH_thisScript constant and sets $_SERVER['SCRIPT_NAME'].
+        *
+        * @return UnitTestsBootstrap fluent interface
+        */
+       protected function defineSitePath() {
+               /** @var string */
+               define('PATH_site', $this->getWebRoot());
+               /** @var string */
+               define('PATH_thisScript', PATH_site . 'typo3/cli_dispatch.phpsh');
+               $_SERVER['SCRIPT_NAME'] = PATH_thisScript;
+
+               return $this;
+       }
+
+       /**
+        * Returns the absolute path the TYPO3 document root.
+        *
+        * @return string the TYPO3 document root using Unix path separators
+        */
+       protected function getWebRoot() {
+               if (getenv('TYPO3_PATH_WEB')) {
+                       $webRoot = getenv('TYPO3_PATH_WEB') . '/';
+               } else {
+                       $webRoot = getcwd() . '/';
+               }
+
+               return strtr($webRoot, '\\', '/');
+       }
+
+       /**
+        * Defines TYPO3_MODE, TYPO3_cliMode and sets the environment variable TYPO3_CONTEXT.
+        *
+        * @return UnitTestsBootstrap fluent interface
+        */
+       protected function setTypo3Context() {
+               /** @var string */
+               define('TYPO3_MODE', 'BE');
+               /** @var string */
+               define('TYPO3_cliMode', TRUE);
+               putenv('TYPO3_CONTEXT=Testing');
+
+               return $this;
+       }
+
+       /**
+        * Creates the following directories in the TYPO3 document root:
+        * - typo3conf
+        * - typo3conf/ext
+        * - typo3temp
+        * - uploads
+        *
+        * @return UnitTestsBootstrap fluent interface
+        */
+       protected function createNecessaryDirectoriesInDocumentRoot() {
+               $this->createDirectory(PATH_site . 'uploads');
+               $this->createDirectory(PATH_site . 'typo3temp');
+               $this->createDirectory(PATH_site . 'typo3conf/ext');
+
+               return $this;
+       }
+
+       /**
+        * Creates the directory $directory (recursively if required).
+        *
+        * If $directory already exists, this method is a no-op.
+        *
+        * @param string $directory absolute path of the directory to be created
+        * @return void
+        * @throws \RuntimeException
+        */
+       protected function createDirectory($directory) {
+               if (is_dir($directory)) {
+                       return;
+               }
+               @mkdir($directory, 0777, TRUE);
+               clearstatcache();
+               if (!is_dir($directory)) {
+                       throw new \RuntimeException('Directory "' . $directory . '" could not be created', 1423043755);
+               }
+       }
+
+       /**
+        * Includes the Core Bootstrap class and calls its first few functions.
+        *
+        * @return UnitTestsBootstrap fluent interface
+        */
+       protected function includeAndStartCoreBootstrap() {
+               require_once PATH_site . '/typo3/sysext/core/Classes/Core/Bootstrap.php';
+
+               Bootstrap::getInstance()
+                       ->baseSetup()
+                       ->initializeClassLoader();
+
+               return $this;
+       }
+
+       /**
+        * Provides the default configuration in $GLOBALS['TYPO3_CONF_VARS'].
+        *
+        * @return UnitTestsBootstrap fluent interface
+        */
+       protected function initializeConfiguration() {
+               $configurationManager = new \TYPO3\CMS\Core\Configuration\ConfigurationManager();
+               $GLOBALS['TYPO3_CONF_VARS'] = $configurationManager->getDefaultConfiguration();
+
+               // avoid failing tests that rely on HTTP_HOST retrieval
+               $GLOBALS['TYPO3_CONF_VARS']['SYS']['trustedHostsPattern'] = '.*';
+
+               return $this;
+       }
+
+       /**
+        * Finishes the last steps of the Core Bootstrap.
+        *
+        * @return UnitTestsBootstrap fluent interface
+        */
+       protected function finishCoreBootstrap() {
+               Bootstrap::getInstance()
+                       ->disableCoreAndClassesCache()
+                       ->initializeCachingFramework()
+                       ->initializeClassLoaderCaches()
+                       ->initializePackageManagement(\TYPO3\CMS\Core\Package\UnitTestPackageManager::class);
+
+               return $this;
+       }
+}
+
+$bootstrap = new UnitTestsBootstrap();
+$bootstrap->bootstrapSystem();
+unset($bootstrap);
diff --git a/typo3/sysext/core/Build/Configuration/FunctionalTestsConfiguration.php b/typo3/sysext/core/Build/Configuration/FunctionalTestsConfiguration.php
deleted file mode 100644 (file)
index 4c6b760..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-<?php
-return array(
-       'SYS' => array(
-               'displayErrors' => '1',
-               'debugExceptionHandler' => '',
-               'trustedHostsPattern' => '.*',
-       )
-);
diff --git a/typo3/sysext/core/Build/FunctionalTests.xml b/typo3/sysext/core/Build/FunctionalTests.xml
deleted file mode 100644 (file)
index 761af79..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-<!--
-       Functional test suites setup
-
-       Functional tests should extend from \TYPO3\CMS\Core\Tests\FunctionalTestCase,
-       take a look at this class for further documentation on how to run the suite.
-
-       TYPO3 CMS functional test suite also needs phpunit bootstrap code, the
-       file is located next to this .xml as FunctionalTestsBootstrap.php
--->
-<phpunit
-       backupGlobals="true"
-       backupStaticAttributes="false"
-       bootstrap="FunctionalTestsBootstrap.php"
-       colors="false"
-       convertErrorsToExceptions="true"
-       convertWarningsToExceptions="true"
-       forceCoversAnnotation="false"
-       processIsolation="true"
-       stopOnError="false"
-       stopOnFailure="false"
-       stopOnIncomplete="false"
-       stopOnSkipped="false"
-       verbose="false"
->
-       <testsuites>
-               <testsuite name="Core tests">
-                       <directory>../../../../typo3/sysext/*/Tests/Functional/</directory>
-               </testsuite>
-       </testsuites>
-</phpunit>
diff --git a/typo3/sysext/core/Build/FunctionalTestsBootstrap.php b/typo3/sysext/core/Build/FunctionalTestsBootstrap.php
deleted file mode 100644 (file)
index 4c06422..0000000
+++ /dev/null
@@ -1,128 +0,0 @@
-<?php
-namespace TYPO3\CMS\Core\Build;
-
-/*
- * This file is part of the TYPO3 CMS project.
- *
- * It is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License, either version 2
- * of the License, or any later version.
- *
- * For the full copyright and license information, please read the
- * LICENSE.txt file that was distributed with this source code.
- *
- * The TYPO3 project - inspiring people to share!
- */
-
-/**
- * This file is defined in FunctionalTests.xml and called by phpunit
- * before instantiating the test suites, it must also be included
- * with phpunit parameter --bootstrap if executing single test case classes.
- */
-class FunctionalTestsBootstrap {
-       /**
-        * Bootstraps the system for unit tests.
-        *
-        * @return void
-        */
-       public function bootstrapSystem() {
-               $this->enableDisplayErrors()
-                       ->loadClassFiles()
-                       ->defineOriginalRootPath()
-                       ->createNecessaryDirectoriesInDocumentRoot();
-       }
-
-       /**
-        * Makes sure error messages during the tests get displayed no matter what is set in php.ini.
-        *
-        * @return FunctionalTestsBootstrap fluent interface
-        */
-       protected function enableDisplayErrors() {
-               @ini_set('display_errors', 1);
-               return $this;
-       }
-
-       /**
-        * Requires classes the functional test classes extend from or use for further bootstrap.
-        * Only files required for "new TestCaseClass" are required here and a general exception
-        * that is thrown by setUp() code.
-        *
-        * @return FunctionalTestsBootstrap fluent interface
-        */
-       protected function loadClassFiles() {
-               $testsDirectory = __DIR__ . '/../Tests/';
-               require_once($testsDirectory . 'BaseTestCase.php');
-               require_once($testsDirectory . 'FunctionalTestCase.php');
-               require_once($testsDirectory . 'FunctionalTestCaseBootstrapUtility.php');
-               require_once($testsDirectory . 'Exception.php');
-
-               return $this;
-       }
-
-       /**
-        * Defines the constant ORIGINAL_ROOT for the path to the original TYPO3 document root.
-        *
-        * If ORIGINAL_ROOT already is defined, this method is a no-op.
-        *
-        * @return FunctionalTestsBootstrap fluent interface
-        */
-       protected function defineOriginalRootPath() {
-               if (!defined('ORIGINAL_ROOT')) {
-                       /** @var string */
-                       define('ORIGINAL_ROOT', $this->getWebRoot());
-               }
-
-               return $this;
-       }
-
-       /**
-        * Creates the following directories in the TYPO3 core:
-        * - typo3temp
-        *
-        * @return FunctionalTestsBootstrap fluent interface
-        */
-       protected function createNecessaryDirectoriesInDocumentRoot() {
-               $this->createDirectory(ORIGINAL_ROOT . 'typo3temp');
-
-               return $this;
-       }
-
-       /**
-        * Creates the directory $directory (recursively if required).
-        *
-        * If $directory already exists, this method is a no-op.
-        *
-        * @param string $directory absolute path of the directory to be created
-        * @return void
-        * @throws \RuntimeException
-        */
-       protected function createDirectory($directory) {
-               if (is_dir($directory)) {
-                       return;
-               }
-               @mkdir($directory, 0777, TRUE);
-               clearstatcache();
-               if (!is_dir($directory)) {
-                       throw new \RuntimeException('Directory "' . $directory . '" could not be created', 1404038665);
-               }
-       }
-
-       /**
-        * Returns the absolute path the TYPO3 document root.
-        *
-        * @return string the TYPO3 document root using Unix path separators
-        */
-       protected function getWebRoot() {
-               if (getenv('TYPO3_PATH_WEB')) {
-                       $webRoot = getenv('TYPO3_PATH_WEB') . '/';
-               } else {
-                       $webRoot = getcwd() . '/';
-               }
-
-               return strtr($webRoot, '\\', '/');
-       }
-}
-
-$bootstrap = new FunctionalTestsBootstrap();
-$bootstrap->bootstrapSystem();
-unset($bootstrap);
diff --git a/typo3/sysext/core/Build/Scripts/xlfcheck.sh b/typo3/sysext/core/Build/Scripts/xlfcheck.sh
deleted file mode 100755 (executable)
index fd3c5ce..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/bin/bash
-
-#########################
-#
-# Find all t3:id numbers in XLF language files
-# and check their uniqueness.
-#
-# @author Markus Klein <klein.t3@reelworx.at>
-# @date 2014-11-14
-#
-##########################
-
-function join { local IFS="$1"; shift; echo "$*"; }
-
-find typo3 -name '*.xlf' > xlffiles.txt
-sed -ne 's/.*t3:id="\([0-9]\+\)".*/\1/pgM' `cat xlffiles.txt` | sort > xlfids.txt
-uniq xlfids.txt > uxlfids.txt
-XLFCNT=$(cat xlffiles.txt | wc -l)
-XLFIDCNT=$(cat xlfids.txt | wc -l)
-UXLFIDCNT=$(cat uxlfids.txt | wc -l)
-DIFFIDS=$(join , $(uniq -d xlfids.txt))
-MISSINGIDS=$(join , $(grep -LP 't3:id' `cat xlffiles.txt`))
-rm xlfids.txt uxlfids.txt xlffiles.txt
-if [ $XLFCNT -ne $XLFIDCNT ];
-then
-       echo "There is at least one XLF file missing a unique ID (t3:id)."
-       echo "Missing in: $MISSINGIDS"
-       exit 1
-fi
-if [ $XLFIDCNT -ne $UXLFIDCNT ];
-then
-       echo "There is an XLF id that does not seem to be UNIQUE."
-       echo "Search for t3:id $DIFFIDS"
-       exit 1
-fi
-exit 0
diff --git a/typo3/sysext/core/Build/UnitTests.xml b/typo3/sysext/core/Build/UnitTests.xml
deleted file mode 100644 (file)
index ab756eb..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-<phpunit
-       backupGlobals="true"
-       backupStaticAttributes="false"
-       bootstrap="UnitTestsBootstrap.php"
-       colors="false"
-       convertErrorsToExceptions="true"
-       convertWarningsToExceptions="true"
-       forceCoversAnnotation="false"
-       processIsolation="false"
-       stopOnError="false"
-       stopOnFailure="false"
-       stopOnIncomplete="false"
-       stopOnSkipped="false"
-       verbose="false"
->
-       <testsuites>
-               <testsuite name="Core tests">
-                       <directory>../../../../typo3/sysext/*/Tests/Unit/</directory>
-               </testsuite>
-               <testsuite name="Core legacy tests">
-                       <directory>../../../../typo3/sysext/core/Tests/Legacy/</directory>
-               </testsuite>
-               <testsuite name="Suite integrity tests">
-                       <directory>../../../../typo3/sysext/core/Tests/Integrity/</directory>
-               </testsuite>
-       </testsuites>
-</phpunit>
diff --git a/typo3/sysext/core/Build/UnitTestsBootstrap.php b/typo3/sysext/core/Build/UnitTestsBootstrap.php
deleted file mode 100644 (file)
index 7517732..0000000
+++ /dev/null
@@ -1,216 +0,0 @@
-<?php
-namespace TYPO3\CMS\Core\Build;
-
-/*
- * This file is part of the TYPO3 CMS project.
- *
- * It is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License, either version 2
- * of the License, or any later version.
- *
- * For the full copyright and license information, please read the
- * LICENSE.txt file that was distributed with this source code.
- *
- * The TYPO3 project - inspiring people to share!
- */
-
-use TYPO3\CMS\Core\Core\Bootstrap;
-
-/**
- * This file is defined in UnitTests.xml and called by phpunit
- * before instantiating the test suites, it must also be included
- * with phpunit parameter --bootstrap if executing single test case classes.
- *
- * For easy access to the PHPUnit and VFS framework, it is recommended to install the phpunit TYPO3 Extension
- * It does not need to be activated, nor a cli user needs to be present.
- * But it is also possible to use other installations of PHPUnit and VFS
- *
- *  * Call whole unit test suite, example:
- * - cd /var/www/t3master/foo  # Document root of TYPO3 CMS instance (location of index.php)
- * - typo3conf/ext/phpunit/Composer/vendor/bin/phpunit -c typo3/sysext/core/Build/UnitTests.xml
- *
- * Call single test case, example:
- * - cd /var/www/t3master/foo  # Document root of TYPO3 CMS instance (location of index.php)
- * - typo3conf/ext/phpunit/Composer/vendor/bin/phpunit \
- *     --bootstrap typo3/sysext/core/Build/UnitTestsBootstrap.php \
- *     typo3/sysext/core/Tests/Uinit/DataHandling/DataHandlerTest.php
- */
-class UnitTestsBootstrap {
-
-       /**
-        * Bootstraps the system for unit tests.
-        *
-        * @return void
-        */
-       public function bootstrapSystem() {
-               $this->enableDisplayErrors()
-                       ->checkForCliDispatch()
-                       ->defineSitePath()
-                       ->setTypo3Context()
-                       ->createNecessaryDirectoriesInDocumentRoot()
-                       ->includeAndStartCoreBootstrap()
-                       ->initializeConfiguration()
-                       ->finishCoreBootstrap();
-       }
-
-       /**
-        * Makes sure error messages during the tests get displayed no matter what is set in php.ini.
-        *
-        * @return UnitTestsBootstrap fluent interface
-        */
-       protected function enableDisplayErrors() {
-               @ini_set('display_errors', 1);
-               return $this;
-       }
-
-       /**
-        * Checks whether the tests are run using the CLI dispatcher. If so, echos a helpful message and exits with
-        * an error code 1.
-        *
-        * @return UnitTestsBootstrap fluent interface
-        */
-       protected function checkForCliDispatch() {
-               if (!defined('TYPO3_MODE')) {
-                       return $this;
-               }
-
-               array_shift($_SERVER['argv']);
-               $flatArguments = implode(' ', $_SERVER['argv']);
-               echo 'Please run the unit tests using the following command:' . chr(10) .
-                       sprintf('typo3conf/ext/phpunit/Composer/vendor/bin/phpunit %s', $flatArguments) . chr(10) .
-                       chr(10);
-
-               exit(1);
-       }
-
-       /**
-        * Defines the PATH_site and PATH_thisScript constant and sets $_SERVER['SCRIPT_NAME'].
-        *
-        * @return UnitTestsBootstrap fluent interface
-        */
-       protected function defineSitePath() {
-               /** @var string */
-               define('PATH_site', $this->getWebRoot());
-               /** @var string */
-               define('PATH_thisScript', PATH_site . 'typo3/cli_dispatch.phpsh');
-               $_SERVER['SCRIPT_NAME'] = PATH_thisScript;
-
-               return $this;
-       }
-
-       /**
-        * Returns the absolute path the TYPO3 document root.
-        *
-        * @return string the TYPO3 document root using Unix path separators
-        */
-       protected function getWebRoot() {
-               if (getenv('TYPO3_PATH_WEB')) {
-                       $webRoot = getenv('TYPO3_PATH_WEB') . '/';
-               } else {
-                       $webRoot = getcwd() . '/';
-               }
-
-               return strtr($webRoot, '\\', '/');
-       }
-
-       /**
-        * Defines TYPO3_MODE, TYPO3_cliMode and sets the environment variable TYPO3_CONTEXT.
-        *
-        * @return UnitTestsBootstrap fluent interface
-        */
-       protected function setTypo3Context() {
-               /** @var string */
-               define('TYPO3_MODE', 'BE');
-               /** @var string */
-               define('TYPO3_cliMode', TRUE);
-               putenv('TYPO3_CONTEXT=Testing');
-
-               return $this;
-       }
-
-       /**
-        * Creates the following directories in the TYPO3 document root:
-        * - typo3conf
-        * - typo3conf/ext
-        * - typo3temp
-        * - uploads
-        *
-        * @return UnitTestsBootstrap fluent interface
-        */
-       protected function createNecessaryDirectoriesInDocumentRoot() {
-               $this->createDirectory(PATH_site . 'uploads');
-               $this->createDirectory(PATH_site . 'typo3temp');
-               $this->createDirectory(PATH_site . 'typo3conf/ext');
-
-               return $this;
-       }
-
-       /**
-        * Creates the directory $directory (recursively if required).
-        *
-        * If $directory already exists, this method is a no-op.
-        *
-        * @param string $directory absolute path of the directory to be created
-        * @return void
-        * @throws \RuntimeException
-        */
-       protected function createDirectory($directory) {
-               if (is_dir($directory)) {
-                       return;
-               }
-               @mkdir($directory, 0777, TRUE);
-               clearstatcache();
-               if (!is_dir($directory)) {
-                       throw new \RuntimeException('Directory "' . $directory . '" could not be created', 1423043755);
-               }
-       }
-
-       /**
-        * Includes the Core Bootstrap class and calls its first few functions.
-        *
-        * @return UnitTestsBootstrap fluent interface
-        */
-       protected function includeAndStartCoreBootstrap() {
-               require_once PATH_site . '/typo3/sysext/core/Classes/Core/Bootstrap.php';
-
-               Bootstrap::getInstance()
-                       ->baseSetup()
-                       ->initializeClassLoader();
-
-               return $this;
-       }
-
-       /**
-        * Provides the default configuration in $GLOBALS['TYPO3_CONF_VARS'].
-        *
-        * @return UnitTestsBootstrap fluent interface
-        */
-       protected function initializeConfiguration() {
-               $configurationManager = new \TYPO3\CMS\Core\Configuration\ConfigurationManager();
-               $GLOBALS['TYPO3_CONF_VARS'] = $configurationManager->getDefaultConfiguration();
-
-               // avoid failing tests that rely on HTTP_HOST retrieval
-               $GLOBALS['TYPO3_CONF_VARS']['SYS']['trustedHostsPattern'] = '.*';
-
-               return $this;
-       }
-
-       /**
-        * Finishes the last steps of the Core Bootstrap.
-        *
-        * @return UnitTestsBootstrap fluent interface
-        */
-       protected function finishCoreBootstrap() {
-               Bootstrap::getInstance()
-                       ->disableCoreAndClassesCache()
-                       ->initializeCachingFramework()
-                       ->initializeClassLoaderCaches()
-                       ->initializePackageManagement(\TYPO3\CMS\Core\Package\UnitTestPackageManager::class);
-
-               return $this;
-       }
-}
-
-$bootstrap = new UnitTestsBootstrap();
-$bootstrap->bootstrapSystem();
-unset($bootstrap);
diff --git a/typo3/sysext/core/Documentation/Changelog/master/Breaking-67076-CoreBuildFolderMovedToTopLevel.rst b/typo3/sysext/core/Documentation/Changelog/master/Breaking-67076-CoreBuildFolderMovedToTopLevel.rst
new file mode 100644 (file)
index 0000000..ea850d0
--- /dev/null
@@ -0,0 +1,26 @@
+=======================================================
+Breaking: #67076 - core/Build folder moved to top level
+=======================================================
+
+Description
+===========
+
+The content of the former build folder ``typo3/sysext/core/Build``  has been moved to the top level folder ``Build``.
+
+
+Impact
+======
+
+All test environments, scripts and manuals need to be updated to use the new (shorter) paths.
+
+
+Affected Installations
+======================
+
+Any extension or test environment using the old paths will stop working.
+
+
+Migration
+=========
+
+Update your scripts, shortcuts, alias, etc to the new (shorter) path.
index 34e8535..def6b6d 100644 (file)
@@ -37,13 +37,13 @@ use TYPO3\CMS\Core\Tests\Functional\Framework\Frontend\Response;
  *
  * Call whole functional test suite, example:
  * - cd /var/www/t3master/foo  # Document root of CMS instance, here is index.php of frontend
- * - ./typo3conf/ext/phpunit/Composer/vendor/bin/phpunit -c typo3/sysext/core/Build/FunctionalTests.xml
+ * - bin/phpunit -c Build/FunctionalTests.xml
  *
  * Call single test case, example:
  * - cd /var/www/t3master/foo  # Document root of CMS instance, here is index.php of frontend
- * - ./typo3conf/ext/phpunit/Composer/vendor/bin/phpunit \
+ * - bin/phpunit \
  *     --process-isolation \
- *     --bootstrap typo3/sysext/core/Build/FunctionalTestsBootstrap.php \
+ *     --bootstrap Build/FunctionalTestsBootstrap.php \
  *     typo3/sysext/core/Tests/Functional/DataHandling/DataHandlerTest.php
  */
 abstract class FunctionalTestCase extends BaseTestCase {
index fd1c40a..7f5f8f9 100644 (file)
@@ -307,7 +307,7 @@ class FunctionalTestCaseBootstrapUtility {
                // Base of final LocalConfiguration is core factory configuration
                $finalConfigurationArray = require ORIGINAL_ROOT . 'typo3/sysext/core/Configuration/FactoryConfiguration.php';
 
-               $this->mergeRecursiveWithOverrule($finalConfigurationArray, require ORIGINAL_ROOT . 'typo3/sysext/core/Build/Configuration/FunctionalTestsConfiguration.php');
+               $this->mergeRecursiveWithOverrule($finalConfigurationArray, require ORIGINAL_ROOT . 'Build/Configuration/FunctionalTestsConfiguration.php');
                $this->mergeRecursiveWithOverrule($finalConfigurationArray, $configurationToMerge);
                $finalConfigurationArray['DB'] = $originalConfigurationArray['DB'];
                // Calculate and set new database name