mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-04 12:44:31 +00:00
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 git-svn-id: https://develop.svn.wordpress.org/trunk@56141 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -114,7 +114,7 @@ class Tests_Admin_wpMediaListTable extends WP_UnitTestCase {
|
||||
* does not result in a PHP warning.
|
||||
*
|
||||
* The warning that we should not see:
|
||||
* PHP 5.6 - 7.4: `Invalid argument supplied for foreach()`.
|
||||
* PHP <= 7.4: `Invalid argument supplied for foreach()`.
|
||||
* PHP 8.0 and higher: `Warning: foreach() argument must be of type array|object, bool given`.
|
||||
*
|
||||
* Note: This does not test the actual functioning of the WP_Media_List_Table::prepare_items() method.
|
||||
|
||||
@@ -117,10 +117,6 @@ class Tests_Date_DateI18n extends WP_UnitTestCase {
|
||||
update_option( 'timezone_string', 'America/Buenos_Aires' ); // This timezone was deprecated pre-PHP 5.6.
|
||||
|
||||
$expected = '2022-08-01 00:00:00 -03 -03:00 America/Buenos_Aires';
|
||||
if ( PHP_VERSION_ID < 70000 ) {
|
||||
// PHP 5.6.
|
||||
$expected = '2022-08-01 00:00:00 ART -03:00 America/Buenos_Aires';
|
||||
}
|
||||
|
||||
$this->assertSame( $expected, date_i18n( 'Y-m-d H:i:s T P e', strtotime( '2022-08-01 00:00:00' ) ) );
|
||||
}
|
||||
|
||||
@@ -210,6 +210,7 @@ class Tests_Functions_wpListUtil extends WP_UnitTestCase {
|
||||
* @dataProvider data_wp_list_util_sort_int_arrays
|
||||
* @dataProvider data_wp_list_util_sort_arrays_of_arrays
|
||||
* @dataProvider data_wp_list_util_sort_object_arrays
|
||||
* @dataProvider data_wp_list_util_sort_non_existent_orderby_fields
|
||||
*
|
||||
* @covers WP_List_Util::sort
|
||||
* @covers ::wp_list_sort
|
||||
@@ -1002,54 +1003,11 @@ class Tests_Functions_wpListUtil extends WP_UnitTestCase {
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests non-existent '$orderby' fields.
|
||||
*
|
||||
* In PHP < 7.0.0, the sorting behavior is different, which Core does not
|
||||
* currently handle. Until this is fixed, or the minimum PHP version is
|
||||
* raised to PHP 7.0.0+, these tests will be skipped on PHP < 7.0.0.
|
||||
*
|
||||
* @ticket 55300
|
||||
*
|
||||
* @dataProvider data_wp_list_util_sort_php_7_or_greater
|
||||
*
|
||||
* @covers WP_List_Util::sort
|
||||
* @covers ::wp_list_sort
|
||||
*
|
||||
* @param array $expected The expected array.
|
||||
* @param array $target_array The array to create a list from.
|
||||
* @param array $orderby Optional. Either the field name to order by or an array
|
||||
* of multiple orderby fields as `$orderby => $order`.
|
||||
* Default empty array.
|
||||
* @param string $order Optional. Either 'ASC' or 'DESC'. Only used if `$orderby`
|
||||
* is a string. Default 'ASC'.
|
||||
* @param bool $preserve_keys Optional. Whether to preserve keys. Default false.
|
||||
*/
|
||||
public function test_wp_list_util_sort_php_7_or_greater( $expected, $target_array, $orderby = array(), $order = 'ASC', $preserve_keys = false ) {
|
||||
if ( version_compare( PHP_VERSION, '7.0.0', '<' ) ) {
|
||||
$this->markTestSkipped( 'This test can only run on PHP 7.0 or greater due to an unstable sort order.' );
|
||||
}
|
||||
|
||||
$util = new WP_List_Util( $target_array );
|
||||
$actual = $util->sort( $orderby, $order, $preserve_keys );
|
||||
|
||||
$this->assertEqualSetsWithIndex(
|
||||
$expected,
|
||||
$actual,
|
||||
'The sorted value did not match the expected value.'
|
||||
);
|
||||
$this->assertEqualSetsWithIndex(
|
||||
$expected,
|
||||
$util->get_output(),
|
||||
'::get_output() did not return the expected value.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Data provider for test_wp_list_util_sort_php_7_or_greater().
|
||||
* Data provider for test_wp_list_util_sort().
|
||||
*
|
||||
* @return array[]
|
||||
*/
|
||||
public function data_wp_list_util_sort_php_7_or_greater() {
|
||||
public function data_wp_list_util_sort_non_existent_orderby_fields() {
|
||||
return array(
|
||||
'int[], int keys, $orderby a non-existent field, $order = ASC and $preserve_keys = false' => array(
|
||||
'expected' => array( 4, 2, 3, 1 ),
|
||||
|
||||
Reference in New Issue
Block a user