mirror of
https://github.com/WordPress/five-for-the-future.git
synced 2025-04-21 10:33:44 +03:00
Tests: Setup PHPUnit and PHPUnit Watcher.
This commit is contained in:
parent
65bd3ad5af
commit
eec9f5cb61
1
plugins/wporg-5ftf/.gitignore
vendored
Normal file
1
plugins/wporg-5ftf/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
vendor
|
28
plugins/wporg-5ftf/composer.json
Normal file
28
plugins/wporg-5ftf/composer.json
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
{
|
||||||
|
"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" : { },
|
||||||
|
"require-dev" : {
|
||||||
|
"phpunit/phpunit" : "^7",
|
||||||
|
"spatie/phpunit-watcher" : "^1.12"
|
||||||
|
},
|
||||||
|
|
||||||
|
"scripts" : {
|
||||||
|
"test" : "vendor/bin/phpunit",
|
||||||
|
"test:watch" : "vendor/bin/phpunit-watcher watch"
|
||||||
|
}
|
||||||
|
}
|
2408
plugins/wporg-5ftf/composer.lock
generated
Normal file
2408
plugins/wporg-5ftf/composer.lock
generated
Normal file
File diff suppressed because it is too large
Load diff
13
plugins/wporg-5ftf/phpunit-watcher.yml.dist
Normal file
13
plugins/wporg-5ftf/phpunit-watcher.yml.dist
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
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
|
17
plugins/wporg-5ftf/phpunit.xml.dist
Normal file
17
plugins/wporg-5ftf/phpunit.xml.dist
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
<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>
|
29
plugins/wporg-5ftf/tests/bootstrap.php
Executable file
29
plugins/wporg-5ftf/tests/bootstrap.php
Executable file
|
@ -0,0 +1,29 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace WordPressDotOrg\FiveForTheFuture\Tests;
|
||||||
|
|
||||||
|
if ( 'cli' !== php_sapi_name() ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
require_once( $core_tests_directory . '/includes/functions.php' );
|
||||||
|
require_once( dirname( dirname( $core_tests_directory ) ) . '/build/wp-admin/includes/plugin.php' );
|
||||||
|
|
||||||
|
tests_add_filter( 'muplugins_loaded', function() {
|
||||||
|
require_once( dirname( __DIR__ ) . '/index.php' );
|
||||||
|
} );
|
||||||
|
|
||||||
|
require_once( $core_tests_directory . '/includes/bootstrap.php' );
|
Loading…
Reference in a new issue