integration
1 month ago
unit
1 year ago
bootstrap.php
1 year ago
composer.json
1 year ago
composer.lock
1 year ago
docker-compose.yml
1 year ago
helpers.php
1 year ago
bootstrap.php
39 lines
| 1 | <?php |
| 2 | |
| 3 | namespace cybot\cookiebot\tests; |
| 4 | |
| 5 | /** |
| 6 | * PHPUnit bootstrap file. |
| 7 | * |
| 8 | * @package Cookiebot |
| 9 | */ |
| 10 | |
| 11 | require_once __DIR__ . '/../vendor/autoload.php'; |
| 12 | require_once __DIR__ . '/./helpers.php'; |
| 13 | require_once __DIR__ . '/../src/addons/addons.php'; |
| 14 | require_once __DIR__ . '/../src/lib/helper.php'; |
| 15 | |
| 16 | $cybot_cookiebot_tests_dir = getenv( 'WP_TESTS_DIR' ); |
| 17 | |
| 18 | if ( ! $cybot_cookiebot_tests_dir ) { |
| 19 | $cybot_cookiebot_tests_dir = rtrim( sys_get_temp_dir(), '/\\' ) . '/wordpress-tests-lib'; |
| 20 | } |
| 21 | |
| 22 | if ( ! file_exists( "{$cybot_cookiebot_tests_dir}/includes/functions.php" ) ) { |
| 23 | echo "Could not find {$cybot_cookiebot_tests_dir}/includes/functions.php, have you run bin/install-wp-tests.sh ?" . PHP_EOL; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 24 | exit( 1 ); |
| 25 | } |
| 26 | |
| 27 | // Give access to tests_add_filter() function. |
| 28 | require_once "{$cybot_cookiebot_tests_dir}/includes/functions.php"; |
| 29 | |
| 30 | tests_add_filter( |
| 31 | 'muplugins_loaded', |
| 32 | function () { |
| 33 | require_once dirname( dirname( __FILE__ ) ) . '/cookiebot.php'; |
| 34 | } |
| 35 | ); |
| 36 | |
| 37 | // Start up the WP testing environment. |
| 38 | require_once "{$cybot_cookiebot_tests_dir}/includes/bootstrap.php"; |
| 39 |