Make WordPress Core


Ignore:
Timestamp:
09/20/2020 12:55:07 AM (4 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-validation.php

    r48937 r49007  
    157157     */
    158158    public function test_format_validation_is_applied_if_missing_type() {
    159         $this->expectException( 'PHPUnit_Framework_Error_Notice' ); // For the undefined index.
     159        if ( PHP_VERSION_ID >= 80000 ) {
     160            $this->expectException( 'PHPUnit_Framework_Error_Warning' ); // For the undefined index.
     161        } else {
     162            $this->expectException( 'PHPUnit_Framework_Error_Notice' );
     163        }
     164
    160165        $this->setExpectedIncorrectUsage( 'rest_validate_value_from_schema' );
    161166
Note: See TracChangeset for help on using the changeset viewer.