Make WordPress Core

Ticket #47169: 47169-alternative-for-wp-5.2.patch

File 47169-alternative-for-wp-5.2.patch, 1.2 KB (added by jrf, 6 years ago)

Alternative patch for the WP 5.2 branch which only impacts the unit tests.

  • tests/phpunit/includes/bootstrap.php

    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', '>=' ) ) { 
    4646        exit( 1 );
    4747}
    4848
     49$php_version = phpversion();
     50include ABSPATH . '/wp-includes/version.php';
     51if ( 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
    4961if ( defined( 'WP_RUN_CORE_TESTS' ) && WP_RUN_CORE_TESTS && ! is_dir( ABSPATH ) ) {
    5062        echo "ERROR: The /build/ directory is missing! Please run `grunt build` prior to running PHPUnit.\n";
    5163        exit( 1 );