mirror of
https://github.com/WordPress/five-for-the-future.git
synced 2025-07-04 02:01:18 +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,32 +0,0 @@
|
|||
{
|
||||
"name" : "wordpress/five-for-the-future",
|
||||
"description" : "Five for the Future plugin",
|
||||
"license" : "GPL-2.0-or-later",
|
||||
|
||||
"authors" : [
|
||||
{
|
||||
"name" : "WordPress",
|
||||
"email" : "support@wordcamp.org"
|
||||
}
|
||||
],
|
||||
|
||||
"config" : {
|
||||
"_comment": "Work around `test:watch` timeout, see https://github.com/spatie/phpunit-watcher/issues/63#issuecomment-545633709",
|
||||
"process-timeout": 0
|
||||
},
|
||||
|
||||
"require" : {},
|
||||
|
||||
"_comment" : "PHPUnit 7.x is the latest version that's compatible with Core, see https://core.trac.wordpress.org/ticket/46149",
|
||||
"require-dev" : {
|
||||
"phpunit/phpunit" : "^7",
|
||||
"spatie/phpunit-watcher" : "^1.12"
|
||||
},
|
||||
|
||||
"scripts" : {
|
||||
"test" : "vendor/bin/phpunit",
|
||||
|
||||
"_comment" : "Input won't work when running this via `composer test:watch`. If you want to use PHPUnit Watcher's interactive options then you'll need to call it directly in your terminal. See https://github.com/composer/composer/issues/5856",
|
||||
"test:watch" : "vendor/bin/phpunit-watcher watch"
|
||||
}
|
||||
}
|
2408
plugins/wporg-5ftf/composer.lock
generated
2408
plugins/wporg-5ftf/composer.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -1,13 +0,0 @@
|
|||
watch:
|
||||
directories:
|
||||
# By default only the `tests/` folder is watched, but the empty value below represents the current directory,
|
||||
# so that tests will also re-run when the files-under-test are changed.
|
||||
-
|
||||
fileMask: '*.php'
|
||||
|
||||
notifications:
|
||||
passingTests: false
|
||||
failingTests: false
|
||||
|
||||
phpunit:
|
||||
binaryPath: vendor/bin/phpunit
|
|
@ -1,17 +0,0 @@
|
|||
<phpunit
|
||||
bootstrap="tests/bootstrap.php"
|
||||
backupGlobals="false"
|
||||
colors="true"
|
||||
convertErrorsToExceptions="true"
|
||||
convertNoticesToExceptions="true"
|
||||
convertWarningsToExceptions="true"
|
||||
>
|
||||
|
||||
<testsuites>
|
||||
<testsuite name="Five for the Future plugin">
|
||||
<directory prefix="test-" suffix=".php">
|
||||
./tests/
|
||||
</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
</phpunit>
|
|
@ -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