[BUGFIX] Test extensions not considered in functional tests 05/26705/4
authorOliver Hader <oliver@typo3.org>
Wed, 8 Jan 2014 23:16:05 +0000 (00:16 +0100)
committerOliver Hader <oliver.hader@typo3.org>
Thu, 9 Jan 2014 10:13:25 +0000 (11:13 +0100)
The functional testing framework offers the possibility to define
custom extension to be installed for each test scenario. However,
this does not work at all, only extensions that are available in
the original base installation can be used.

This change cleans and adds the package state definition for any
extension to be used during a functional test execution.

Fixes: #54857
Releases: 6.2
Change-Id: I91b1cd1bc5d147287a154283e94d03d1392ac92d
Reviewed-on: https://review.typo3.org/26705
Reviewed-by: Markus Klein
Tested-by: Markus Klein
Reviewed-by: Thomas Maroschik
Reviewed-by: Oliver Hader
Tested-by: Oliver Hader
typo3/sysext/core/Tests/FunctionalTestCaseBootstrapUtility.php

index 2bf2093..1145795 100644 (file)
@@ -204,8 +204,6 @@ class FunctionalTestCaseBootstrapUtility {
        /**
         * Create LocalConfiguration.php file in the test instance
         *
-        * @param array $coreExtensionsToLoad Additional core extensions to load
-        * @param array $testExtensionPaths Paths to extensions relative to document root
         * @throws Exception
         * @return void
         */
@@ -257,6 +255,27 @@ class FunctionalTestCaseBootstrapUtility {
                $packageStates = require ORIGINAL_ROOT . 'typo3conf/PackageStates.php';
                $packageStates['packages']['phpunit']['packagePath'] = '../../' . $packageStates['packages']['phpunit']['packagePath'];
 
+               // Activate core extensions if currently inactive
+               foreach ($coreExtensionsToLoad as $extensionName) {
+                       if (!empty($packageStates['packages'][$extensionName]['state']) && $packageStates['packages'][$extensionName]['state'] !== 'active') {
+                               $packageStates['packages'][$extensionName]['state'] = 'active';
+                       }
+               }
+
+               // Clean and activate test extensions that have been symlinked before
+               foreach ($testExtensionPaths as $extensionPath) {
+                       $extensionName = basename($extensionPath);
+                       if (!empty($packageStates['packages'][$extensionName])) {
+                               unset($packageStates['packages'][$extensionName]);
+                       }
+
+                       $packageStates['packages'][$extensionName] = array(
+                               'state' => 'active',
+                               'packagePath' => 'typo3conf/ext/' . $extensionName . '/',
+                               'classesPath' => 'Classes/',
+                       );
+               }
+
                $result = $this->writeFile(
                        $this->instancePath . '/typo3conf/PackageStates.php',
                        '<?php' . chr(10) .