Make WordPress Core


Ignore:
Timestamp:
07/05/2023 05:39:55 PM (17 months ago)
Author:
johnbillion
Message:

General: Increase the minimum supported version of PHP to 7.0.0.

This also removes the random compat library which is no longer necessary, and adjusts unit tests and CI workflows that no longer need to take PHP 5.6 into account.

Thank you for your service, PHP 5. Onwards!

Props SergeyBiryukov, mukesh27, dingo_d, audrasjb, jrf, costdev, azaozz, JavierCasares, hellofromTonya, samiamnot, spacedmonkey, masteradhoc, knutsp, garyjones, chanthaboune

Fixes #57345

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/functions/wpListUtil.php

    r55423 r56141  
    211211     * @dataProvider data_wp_list_util_sort_arrays_of_arrays
    212212     * @dataProvider data_wp_list_util_sort_object_arrays
     213     * @dataProvider data_wp_list_util_sort_non_existent_orderby_fields
    213214     *
    214215     * @covers WP_List_Util::sort
     
    10031004
    10041005    /**
    1005      * Tests non-existent '$orderby' fields.
    1006      *
    1007      * In PHP < 7.0.0, the sorting behavior is different, which Core does not
    1008      * currently handle. Until this is fixed, or the minimum PHP version is
    1009      * raised to PHP 7.0.0+, these tests will be skipped on PHP < 7.0.0.
    1010      *
    1011      * @ticket 55300
    1012      *
    1013      * @dataProvider data_wp_list_util_sort_php_7_or_greater
    1014      *
    1015      * @covers WP_List_Util::sort
    1016      * @covers ::wp_list_sort
    1017      *
    1018      * @param array  $expected      The expected array.
    1019      * @param array  $target_array  The array to create a list from.
    1020      * @param array  $orderby       Optional. Either the field name to order by or an array
    1021      *                              of multiple orderby fields as `$orderby => $order`.
    1022      *                              Default empty array.
    1023      * @param string $order         Optional. Either 'ASC' or 'DESC'. Only used if `$orderby`
    1024      *                              is a string. Default 'ASC'.
    1025      * @param bool   $preserve_keys Optional. Whether to preserve keys. Default false.
    1026      */
    1027     public function test_wp_list_util_sort_php_7_or_greater( $expected, $target_array, $orderby = array(), $order = 'ASC', $preserve_keys = false ) {
    1028         if ( version_compare( PHP_VERSION, '7.0.0', '<' ) ) {
    1029             $this->markTestSkipped( 'This test can only run on PHP 7.0 or greater due to an unstable sort order.' );
    1030         }
    1031 
    1032         $util   = new WP_List_Util( $target_array );
    1033         $actual = $util->sort( $orderby, $order, $preserve_keys );
    1034 
    1035         $this->assertEqualSetsWithIndex(
    1036             $expected,
    1037             $actual,
    1038             'The sorted value did not match the expected value.'
    1039         );
    1040         $this->assertEqualSetsWithIndex(
    1041             $expected,
    1042             $util->get_output(),
    1043             '::get_output() did not return the expected value.'
    1044         );
    1045     }
    1046 
    1047     /**
    1048      * Data provider for test_wp_list_util_sort_php_7_or_greater().
     1006     * Data provider for test_wp_list_util_sort().
    10491007     *
    10501008     * @return array[]
    10511009     */
    1052     public function data_wp_list_util_sort_php_7_or_greater() {
     1010    public function data_wp_list_util_sort_non_existent_orderby_fields() {
    10531011        return array(
    10541012            'int[], int keys, $orderby a non-existent field, $order = ASC and $preserve_keys = false' => array(
Note: See TracChangeset for help on using the changeset viewer.