Tests: Update infrastructure & add travis config (#100)

* Tests: Move tests infrastructure, set up travis

Consolidates the composer files so we can run install once in travis.

* Return empty array if no values are $_POST'ed to the form

Fixes an issue with tests + null values in logs

* Clean up some naming & create helper functions for tests

* Debug travis

* Remove debug

* Fix notices on form

* Turn on multisite flag
This commit is contained in:
Kelly Dwan 2019-11-15 17:40:53 -05:00 committed by GitHub
parent 5c2041442a
commit 03949905c0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 2705 additions and 2583 deletions

View file

@ -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';