diff --git a/tests/phpunit/includes/spy-rest-server.php b/tests/phpunit/includes/spy-rest-server.php
index 49cda8748a..8bf1af43bd 100644
|
a
|
b
|
class Spy_REST_Server extends WP_REST_Server {
|
| 25 | 25 | * @return mixed |
| 26 | 26 | */ |
| 27 | 27 | public function __call( $method, $args ) { |
| | 28 | if ( ! method_exists( $this, $method ) ) { |
| | 29 | throw new \Error( sprintf( 'Call to undefined method %s::%s', get_class( $this ), $method ) ); |
| | 30 | } |
| 28 | 31 | return call_user_func_array( array( $this, $method ), $args ); |
| 29 | 32 | } |
| 30 | 33 | |
diff --git a/tests/phpunit/tests/rest-api.php b/tests/phpunit/tests/rest-api.php
index 4a575b8803..2c9156cb30 100644
|
a
|
b
|
class Tests_REST_API extends WP_UnitTestCase {
|
| 2537 | 2537 | |
| 2538 | 2538 | $this->assertTrue( $registered ); |
| 2539 | 2539 | } |
| | 2540 | |
| | 2541 | public function test_rest_get_server_fails_with_undefined_method() { |
| | 2542 | $this->expectException( \Error::class ); |
| | 2543 | rest_get_server()->does_not_exist(); |
| | 2544 | } |
| 2540 | 2545 | } |