From 9d2bdd112e8ccb1f531ce7a45c36dfc725221bde Mon Sep 17 00:00:00 2001
From: jrfnl <jrfnl@users.noreply.github.com>
Date: Tue, 7 May 2019 18:05:45 +0200
Subject: [PATCH] Build/Tests: exit with error code 1 when WP requirements are
not met (unit tests only)
---
tests/phpunit/includes/bootstrap.php | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/tests/phpunit/includes/bootstrap.php b/tests/phpunit/includes/bootstrap.php
index 23faca64e5..240ffdaedc 100644
a
|
b
|
if ( version_compare( tests_get_phpunit_version(), '8.0', '>=' ) ) { |
46 | 46 | exit( 1 ); |
47 | 47 | } |
48 | 48 | |
| 49 | $php_version = phpversion(); |
| 50 | include ABSPATH . '/wp-includes/version.php'; |
| 51 | if ( version_compare( $required_php_version, $php_version, '>' ) ) { |
| 52 | printf( |
| 53 | 'ERROR: Your server is running PHP version %1$s but WordPress %2$s requires at least %3$s. The unit tests will not be run.' . PHP_EOL, |
| 54 | $php_version, |
| 55 | $wp_version, |
| 56 | $required_php_version |
| 57 | ); |
| 58 | exit( 1 ); |
| 59 | } |
| 60 | |
49 | 61 | if ( defined( 'WP_RUN_CORE_TESTS' ) && WP_RUN_CORE_TESTS && ! is_dir( ABSPATH ) ) { |
50 | 62 | echo "ERROR: The /build/ directory is missing! Please run `grunt build` prior to running PHPUnit.\n"; |
51 | 63 | exit( 1 ); |