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.

git-svn-id: https://develop.svn.wordpress.org/trunk@48993 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2020-09-18 10:56:27 +00:00
parent cb356d9cfc
commit bc556578b3

View File

@ -25,10 +25,13 @@ class Tests_Locale extends WP_UnitTestCase {
$this->assertSame( __( 'Saturday' ), $this->locale->get_weekday( 6 ) );
}
/**
* @expectedException PHPUnit_Framework_Error_Notice
*/
public function test_get_weekday_undefined_index() {
if ( PHP_VERSION_ID >= 80000 ) {
$this->expectException( 'PHPUnit_Framework_Error_Warning' );
} else {
$this->expectException( 'PHPUnit_Framework_Error_Notice' );
}
$this->locale->get_weekday( 7 );
}