mirror of
https://github.com/WordPress/five-for-the-future.git
synced 2025-07-04 10:05:43 +03:00
Tests: Move tests infrastructure, set up travis
Consolidates the composer files so we can run install once in travis.
This commit is contained in:
parent
5c2041442a
commit
68d5c53c95
10 changed files with 2618 additions and 2488 deletions
|
@ -1,29 +1,29 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPUnit bootstrap file
|
||||
*/
|
||||
|
||||
namespace WordPressDotOrg\FiveForTheFuture\Tests;
|
||||
$_tests_dir = getenv( 'WP_TESTS_DIR' );
|
||||
|
||||
if ( 'cli' !== php_sapi_name() ) {
|
||||
return;
|
||||
if ( ! $_tests_dir ) {
|
||||
$_tests_dir = rtrim( sys_get_temp_dir(), '/\\' ) . '/wordpress-tests-lib';
|
||||
}
|
||||
|
||||
|
||||
define( 'WP_PLUGIN_DIR', dirname( dirname( __DIR__ ) ) );
|
||||
|
||||
|
||||
$core_tests_directory = getenv( 'WP_TESTS_DIR' );
|
||||
|
||||
if ( ! $core_tests_directory ) {
|
||||
echo "\nPlease set the WP_TESTS_DIR environment variable to the folder where WordPress' PHPUnit tests live --";
|
||||
echo "\ne.g., export WP_TESTS_DIR=/srv/www/wordpress-develop/tests/phpunit\n";
|
||||
|
||||
return;
|
||||
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 );
|
||||
}
|
||||
|
||||
require_once $core_tests_directory . '/includes/functions.php';
|
||||
require_once dirname( dirname( $core_tests_directory ) ) . '/build/wp-admin/includes/plugin.php';
|
||||
// Give access to tests_add_filter() function.
|
||||
require_once $_tests_dir . '/includes/functions.php';
|
||||
|
||||
tests_add_filter( 'muplugins_loaded', function() {
|
||||
require_once dirname( __DIR__ ) . '/index.php';
|
||||
} );
|
||||
/**
|
||||
* Manually load the plugin being tested.
|
||||
*/
|
||||
function _manually_load_plugin() {
|
||||
require dirname( dirname( __FILE__ ) ) . '/index.php';
|
||||
}
|
||||
tests_add_filter( 'muplugins_loaded', '_manually_load_plugin' );
|
||||
|
||||
require_once $core_tests_directory . '/includes/bootstrap.php';
|
||||
// Start up the WP testing environment.
|
||||
require $_tests_dir . '/includes/bootstrap.php';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue