File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 105105
106106 <!-- These are stand-alone files that are copied into the test run directory and
107107 executed by the child WP-CLI process, not loaded as part of this package.
108- They declare a class once per supported Requests major version, and their
109- method signatures are dictated by the transport interface they implement,
108+ Their method signatures are dictated by the transport interface they implement,
110109 so unused parameters cannot be dropped. -->
111- <rule ref =" Generic.Files.OneObjectStructurePerFile" >
112- <exclude-pattern >*/src/Context/templates/*</exclude-pattern >
113- </rule >
114- <rule ref =" Generic.Classes.DuplicateClassName" >
115- <exclude-pattern >*/src/Context/templates/*</exclude-pattern >
116- </rule >
117110 <rule ref =" Generic.CodeAnalysis.UnusedFunctionParameter" >
118111 <exclude-pattern >*/src/Context/templates/*</exclude-pattern >
119112 </rule >
Original file line number Diff line number Diff line change @@ -46,20 +46,23 @@ public static function test( $capabilities = array() ) {
4646 }
4747}
4848
49- if ( interface_exists ( '\WpOrg\Requests\Transport ' ) ) {
50- class WP_CLI_Tests_Mock_Requests_Transport implements \WpOrg \Requests \Transport {
51- use WP_CLI_Tests_Mock_Requests_Trait;
52- }
53- } else {
54- class WP_CLI_Tests_Mock_Requests_Transport implements \Requests_Transport {
55- use WP_CLI_Tests_Mock_Requests_Trait;
56- }
57- }
58-
5949WP_CLI ::add_hook (
6050 'http_request_options ' ,
6151 static function ( $ options ) {
62- $ options ['transport ' ] = new WP_CLI_Tests_Mock_Requests_Transport ();
52+ if ( class_exists ( '\WP_CLI\RequestsLibrary ' ) && method_exists ( '\WP_CLI\RequestsLibrary ' , 'register_autoloader ' ) ) {
53+ \WP_CLI \RequestsLibrary ::register_autoloader ();
54+ }
55+
56+ if ( interface_exists ( '\WpOrg\Requests\Transport ' ) ) {
57+ $ options ['transport ' ] = new class () implements \WpOrg \Requests \Transport {
58+ use WP_CLI_Tests_Mock_Requests_Trait;
59+ };
60+ } else {
61+ $ options ['transport ' ] = new class () implements \Requests_Transport {
62+ use WP_CLI_Tests_Mock_Requests_Trait;
63+ };
64+ }
65+
6366 return $ options ;
6467 }
6568);
You can’t perform that action at this time.
0 commit comments