EGroupware /
egroupware
| 1 | <?php |
||
| 2 | /** |
||
| 3 | * Run before PHPUnit starts - common stuff for _all_ tests, like getting |
||
| 4 | * the autoloader. |
||
| 5 | * This file is automatically run once before starting. |
||
| 6 | * |
||
| 7 | * @link http://www.egroupware.org |
||
| 8 | * @author Nathan Gray |
||
| 9 | * @package |
||
| 10 | * @copyright (c) 2017 Nathan Gray |
||
| 11 | * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License |
||
| 12 | */ |
||
| 13 | |||
| 14 | // autoloader & check_load_extension |
||
| 15 | require_once realpath(__DIR__.'/../api/src/loader/common.php'); |
||
| 16 | |||
| 17 | // backward compatibility with PHPunit 5.7 |
||
| 18 | if (!class_exists('\PHPUnit\Framework\TestCase') && class_exists('\PHPUnit_Framework_TestCase')) |
||
| 19 | { |
||
| 20 | class_alias('\PHPUnit_Framework_TestCase', '\PHPUnit\Framework\TestCase'); |
||
| 21 | class_alias('\PHPUnit_Framework_ExpectationFailedException', '\PHPUnit\Framework\ExpectationFailedException'); |
||
| 22 | } |
||
| 23 | |||
| 24 | // Needed to let Cache work |
||
| 25 | $GLOBALS['egw_info']['server']['temp_dir'] = '/tmp'; |
||
| 26 | $GLOBALS['egw_info']['server']['install_id'] = 'PHPUnit test'; |
||
| 27 | |||
| 28 | // Symlink api/src/fixtures/apps/* to root |
||
| 29 | foreach(scandir($path=__DIR__.'/../api/tests/fixtures/apps') as $app) |
||
| 30 | { |
||
| 31 | if (is_dir($path.'/'.$app) && @file_exists($path.'/'.$app.'/setup/setup.inc.php')/* && |
||
| 32 | readlink(__DIR__.'/../'.$app) !== 'api/tests/fixtures/apps/'.$app*/) |
||
| 33 | { |
||
| 34 | @unlink(__DIR__.'/../'.$app); |
||
|
0 ignored issues
–
show
|
|||
| 35 | symlink('api/tests/fixtures/apps/'.$app, __DIR__.'/../'.$app); |
||
| 36 | // install fixture app |
||
| 37 | shell_exec(PHP_BINARY.' '.__DIR__.'/rpm-build/post_install.php --install-update-app '.$app); |
||
| 38 | } |
||
| 39 | } |
||
| 40 |
If you suppress an error, we recommend checking for the error condition explicitly: