f2e33e77d32f27f51b0cce4bfb36095f4a41a561
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Build / FunctionalTestsBootstrap.php
1 <?php
2 /*
3 * This file is part of the TYPO3 CMS project.
4 *
5 * It is free software; you can redistribute it and/or modify it under
6 * the terms of the GNU General Public License, either version 2
7 * of the License, or any later version.
8 *
9 * For the full copyright and license information, please read the
10 * LICENSE.txt file that was distributed with this source code.
11 *
12 * The TYPO3 project - inspiring people to share!
13 */
14
15 /**
16 * This file is defined in FunctionalTests.xml and called by phpunit
17 * before instantiating the test suites, it must also be included
18 * with phpunit parameter --bootstrap if executing single test case classes.
19 */
20
21 /**
22 * Make sure error messages during the tests get displayed no matter what is set in php.ini.
23 */
24 @ini_set('display_errors', 1);
25
26 /**
27 * Require classes the functional test classes extend from or use for further bootstrap.
28 * Only files required for "new TestCaseClass" are required here and a general exception
29 * that is thrown by setUp() code.
30 */
31 require_once(__DIR__ . '/../Tests/BaseTestCase.php');
32 require_once(__DIR__ . '/../Tests/FunctionalTestCase.php');
33 require_once(__DIR__ . '/../Tests/FunctionalTestCaseBootstrapUtility.php');
34 require_once(__DIR__ . '/../Tests/Exception.php');
35
36 /**
37 * Define a constant to specify the document root since this calculation would
38 * be way more complicated if done within the test class.
39 *
40 * It is required that phpunit binary is called from the document root of the instance,
41 * or TYPO3_PATH_WEB environement variable needs to be set,
42 * otherwise path calculation, of the created TYPO3 CMS instance will fail.
43 */
44 if (getenv('TYPO3_PATH_WEB')) {
45 $webRoot = getenv('TYPO3_PATH_WEB') . '/';
46 } elseif (isset($_SERVER['PWD'])) {
47 $webRoot = $_SERVER['PWD'] . '/';
48 } else {
49 $webRoot = getcwd() . '/';
50 }
51 $webRoot = strtr($webRoot, '\\', '/');
52
53 if (!defined('ORIGINAL_ROOT')) {
54 define('ORIGINAL_ROOT', $webRoot);
55 }
56
57 unset($webRoot);