This repository has been archived by the owner on Apr 4, 2023. It is now read-only.
forked from acegiak/Semantic-Linkbacks
-
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
24 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,40 @@ | ||
<?php | ||
/** | ||
* PHPUnit bootstrap file | ||
* | ||
* @package semantic-linkbacks | ||
*/ | ||
|
||
error_reporting( E_ALL & ~E_NOTICE & ~E_STRICT & ~E_WARNING ); | ||
|
||
define( 'WP_DEBUG', false ); | ||
// Forward custom PHPUnit Polyfills configuration to PHPUnit bootstrap file. | ||
$_phpunit_polyfills_path = getenv( 'WP_TESTS_PHPUNIT_POLYFILLS_PATH' ); | ||
if ( false !== $_phpunit_polyfills_path ) { | ||
define( 'WP_TESTS_PHPUNIT_POLYFILLS_PATH', $_phpunit_polyfills_path ); | ||
} | ||
|
||
$_tests_dir = getenv( 'WP_TESTS_DIR' ); | ||
|
||
if ( ! $_tests_dir ) { | ||
$_tests_dir = '/tmp/wordpress-tests-lib'; | ||
$_tests_dir = rtrim( sys_get_temp_dir(), '/\\' ) . '/wordpress-tests-lib'; | ||
} | ||
|
||
if ( ! file_exists( $_tests_dir . '/includes/functions.php' ) ) { | ||
echo "Could not find $_tests_dir/includes/functions.php, have you run bin/install-wp-tests.sh ?" . PHP_EOL; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | ||
exit( 1 ); | ||
} | ||
|
||
// Give access to tests_add_filter() function. | ||
require_once $_tests_dir . '/includes/functions.php'; | ||
|
||
require_once dirname( dirname( __FILE__ ) ) . '/vendor/yoast/phpunit-polyfills/phpunitpolyfills-autoload.php'; | ||
|
||
/** | ||
* Manually load the plugin being tested. | ||
*/ | ||
function _manually_load_plugin() { | ||
require dirname( dirname( __FILE__ ) ) . '/semantic-linkbacks.php'; | ||
} | ||
tests_add_filter( 'muplugins_loaded', '_manually_load_plugin' ); | ||
|
||
// Start up the WP testing environment. | ||
require $_tests_dir . '/includes/bootstrap.php'; | ||
|
||
error_reporting( E_ALL & ~E_NOTICE & ~E_STRICT & ~E_WARNING ); |