Make WordPress Core


Ignore:
Timestamp:
09/18/2020 10:56:27 AM (4 years ago)
Author:
SergeyBiryukov
Message:

Tests: Fix the failure in test_get_weekday_undefined_index() on PHP 8.

The test ensures that WP_Locale::get_weekday() throws an "undefined offset" notice when called with an incorrect $weekday_number parameter.

In PHP 8, that notice is now a warning, so the test needs to be adjusted accordingly.

See #50913.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/locale.php

    r48937 r48993  
    2626    }
    2727
    28     /**
    29      * @expectedException PHPUnit_Framework_Error_Notice
    30      */
    3128    public function test_get_weekday_undefined_index() {
     29        if ( PHP_VERSION_ID >= 80000 ) {
     30            $this->expectException( 'PHPUnit_Framework_Error_Warning' );
     31        } else {
     32            $this->expectException( 'PHPUnit_Framework_Error_Notice' );
     33        }
     34
    3235        $this->locale->get_weekday( 7 );
    3336    }
Note: See TracChangeset for help on using the changeset viewer.