- Timestamp:
- 11/11/2021 04:58:27 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/rest-api/rest-plugins-controller.php
r51568 r52138 547 547 public function test_create_item_unknown_plugin() { 548 548 wp_set_current_user( self::$super_admin ); 549 550 // This will hit the live API. 549 add_filter( 550 'pre_http_request', 551 static function() { 552 /* 553 * Mocks the request to: 554 * https://api.wordpress.org/plugins/info/1.2/?action=plugin_information&request%5Bslug%5D=alex-says-this-block-definitely-doesnt-exist&request%5Bfields%5D%5Bsections%5D=0&request%5Bfields%5D%5Blanguage_packs%5D=1&request%5Blocale%5D=en_US&request%5Bwp_version%5D=5.9 555 */ 556 return array( 557 'headers' => array(), 558 'response' => array( 559 'code' => 404, 560 'message' => 'Not Found', 561 ), 562 'body' => '{"error":"Plugin not found."}', 563 'cookies' => array(), 564 'filename' => null, 565 ); 566 } 567 ); 568 551 569 $request = new WP_REST_Request( 'POST', self::BASE ); 552 570 $request->set_body_params( array( 'slug' => 'alex-says-this-block-definitely-doesnt-exist' ) );
Note: See TracChangeset
for help on using the changeset viewer.