HEX
Server: Apache
System: Linux pdx1-shared-a1-38 6.6.104-grsec-jammy+ #3 SMP Tue Sep 16 00:28:11 UTC 2025 x86_64
User: mmickelson (3396398)
PHP: 8.1.31
Disabled: NONE
Upload Files
File: //usr/local/wp/tests/mock-requests-transport.php
<?php

use WpOrg\Requests\Transport;

// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedClassFound
class Mock_Requests_Transport implements Transport {
	public $requests = [];

	public function request( $url, $headers = [], $data = [], $options = [] ) {
		// Simulate retrying.
		if (
			isset( $options['insecure'] )
			&& $options['insecure']
			&& isset( $options['verify'] )
			&& false !== strpos( $options['verify'], sys_get_temp_dir() )
		) {
			$options['verify'] = false;
		}

		$this->requests[] = compact( 'url', 'headers', 'data', 'options' );

		return 'HTTP/1.1 418' . "\r\n"
			. 'Content-Type: water/leaf-infused' . "\r\n"
			. "\r\n\r\n"; // This last line is actually important or the request will error.
	}

	public function request_multiple( $requests, $options ) {
		throw new Exception( 'Method not implemented: ' . __METHOD__ );
	}

	public static function test( $capabilities = [] ) {
		return true;
	}
}