Make WordPress Core


Ignore:
Timestamp:
09/20/2020 12:55:07 AM (3 years ago)
Author:
SergeyBiryukov
Message:

Tests: Fix the failures in REST API format keyword validation tests on PHP 8.

The tests ensure that rest_sanitize_value_from_schema() and rest_validate_value_from_schema() throw an "undefined offset" notice when the required type schema keyword is not passed.

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

Follow-up to [48300], [48993].

See #50913.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/rest-api/rest-schema-sanitization.php

    r48937 r49007  
    361361     */
    362362    public function test_format_validation_is_applied_if_missing_type() {
    363         $this->expectException( 'PHPUnit_Framework_Error_Notice' ); // For the undefined index.
     363        if ( PHP_VERSION_ID >= 80000 ) {
     364            $this->expectException( 'PHPUnit_Framework_Error_Warning' ); // For the undefined index.
     365        } else {
     366            $this->expectException( 'PHPUnit_Framework_Error_Notice' );
     367        }
     368
    364369        $this->setExpectedIncorrectUsage( 'rest_sanitize_value_from_schema' );
    365370
Note: See TracChangeset for help on using the changeset viewer.