summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--composer.json3
-rw-r--r--composer.lock20
-rw-r--r--tests/phpunit/includes/bootstrap.php40
3 files changed, 53 insertions, 10 deletions
diff --git a/composer.json b/composer.json
index 4997175bfe..f2a9503e80 100644
--- a/composer.json
+++ b/composer.json
@@ -16,7 +16,8 @@
"dealerdirect/phpcodesniffer-composer-installer": "^0.6.2 || ^0.7.0",
"wp-coding-standards/wpcs": "~2.3.0",
"phpcompatibility/phpcompatibility-wp": "^2.1.0",
- "phpunit/phpunit": "^7.5"
+ "phpunit/phpunit": "^7.5",
+ "ext-gd": "*"
},
"autoload-dev": {
"files": [
diff --git a/composer.lock b/composer.lock
index 007bbf83ea..14bdf41411 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "463db2b4afb439fb63d93173c0852e27",
+ "content-hash": "fcf040d9233a22165eeffaeb98694436",
"packages": [],
"packages-dev": [
{
@@ -131,6 +131,20 @@
"constructor",
"instantiate"
],
+ "funding": [
+ {
+ "url": "https://www.doctrine-project.org/sponsorship.html",
+ "type": "custom"
+ },
+ {
+ "url": "https://www.patreon.com/phpdoctrine",
+ "type": "patreon"
+ },
+ {
+ "url": "https://tidelift.com/funding/github/packagist/doctrine%2Finstantiator",
+ "type": "tidelift"
+ }
+ ],
"time": "2020-05-29T17:27:14+00:00"
},
{
@@ -1837,6 +1851,8 @@
"platform": {
"php": ">=5.6"
},
- "platform-dev": [],
+ "platform-dev": {
+ "ext-gd": "*"
+ },
"plugin-api-version": "1.1.0"
}
diff --git a/tests/phpunit/includes/bootstrap.php b/tests/phpunit/includes/bootstrap.php
index 876c81941e..88937d05f7 100644
--- a/tests/phpunit/includes/bootstrap.php
+++ b/tests/phpunit/includes/bootstrap.php
@@ -37,6 +37,11 @@ if ( ! is_readable( $config_file_path ) ) {
require_once $config_file_path;
require_once __DIR__ . '/functions.php';
+if ( defined( 'WP_RUN_CORE_TESTS' ) && WP_RUN_CORE_TESTS && ! is_dir( ABSPATH ) ) {
+ echo "Error: The /build/ directory is missing! Please run `npm run build` prior to running PHPUnit.\n";
+ exit( 1 );
+}
+
$phpunit_version = tests_get_phpunit_version();
if ( version_compare( $phpunit_version, '5.4', '<' ) || version_compare( $phpunit_version, '8.0', '>=' ) ) {
@@ -48,8 +53,23 @@ if ( version_compare( $phpunit_version, '5.4', '<' ) || version_compare( $phpuni
exit( 1 );
}
-if ( defined( 'WP_RUN_CORE_TESTS' ) && WP_RUN_CORE_TESTS && ! is_dir( ABSPATH ) ) {
- echo "Error: The /build/ directory is missing! Please run `npm run build` prior to running PHPUnit.\n";
+$required_extensions = array(
+ 'gd',
+);
+$missing_extensions = array();
+
+foreach ( $required_extensions as $extension ) {
+ if ( ! extension_loaded( $extension ) ) {
+ $missing_extensions[] = $extension;
+ }
+}
+
+if ( $missing_extensions ) {
+ printf(
+ "Error: The following required PHP extensions are missing from the testing environment: %s.\n",
+ implode( ', ', $missing_extensions )
+ );
+ echo "Please make sure they are installed and enabled.\n",
exit( 1 );
}
@@ -59,17 +79,23 @@ $required_constants = array(
'WP_TESTS_TITLE',
'WP_PHP_BINARY',
);
+$missing_constants = array();
foreach ( $required_constants as $constant ) {
if ( ! defined( $constant ) ) {
- printf(
- "Error: The required %s constant is not defined. Check out `wp-tests-config-sample.php` for an example.\n",
- $constant
- );
- exit( 1 );
+ $missing_constants[] = $constant;
}
}
+if ( $missing_constants ) {
+ printf(
+ "Error: The following required constants are not defined: %s.\n",
+ implode( ', ', $missing_constants )
+ );
+ echo "Please check out `wp-tests-config-sample.php` for an example.\n",
+ exit( 1 );
+}
+
tests_reset__SERVER();
define( 'WP_TESTS_TABLE_PREFIX', $table_prefix );