cdecd3902364bc32e0e1ed313db486a93156b80a
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Build / FunctionalTestsBootstrap.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 2013 Christian Kuhn <lolli@schwarzbu.ch>
6 * All rights reserved
7 *
8 * This script is part of the TYPO3 project. The TYPO3 project is
9 * free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * The GNU General Public License can be found at
15 * http://www.gnu.org/copyleft/gpl.html.
16 *
17 * This script is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * This copyright notice MUST APPEAR in all copies of the script!
23 ***************************************************************/
24
25 /**
26 * This file is defined in FuntionalTests.xml and called by phpunit
27 * before instantiating the test suites, it must also be included
28 * with phpunit parameter --bootstrap if executing single test case classes.
29 */
30
31 /**
32 * Require classes the functional test classes extend from or use for further bootstrap.
33 * Only files required for "new TestCaseClass" are required here and a general exception
34 * that is thrown by setUp() code.
35 */
36 require_once(__DIR__ . '/../Tests/BaseTestCase.php');
37 require_once(__DIR__ . '/../Tests/FunctionalTestCase.php');
38 require_once(__DIR__ . '/../Tests/FunctionalTestCaseBootstrapUtility.php');
39 require_once(__DIR__ . '/../Tests/Exception.php');
40
41 /**
42 * Define a constant to specify the document root since this calculation would
43 * be way more complicated if done within the test class.
44 *
45 * It is required that phpunit binary is called from the document root of the instance,
46 * or TYPO3_PATH_WEB environement variable needs to be set,
47 * otherwise path calculation, of the created TYPO3 CMS instance will fail.
48 */
49 if (getenv('TYPO3_PATH_WEB')) {
50 $webRoot = getenv('TYPO3_PATH_WEB') . '/';
51 } elseif (isset($_SERVER['PWD'])) {
52 $webRoot = $_SERVER['PWD'] . '/';
53 } else {
54 $webRoot = getcwd() . '/';
55 }
56 $webRoot = strtr($webRoot, '\\', '/');
57
58 if (!defined('ORIGINAL_ROOT')) {
59 define('ORIGINAL_ROOT', $webRoot);
60 }
61
62 unset($webRoot);