diff --git a/dev/tests/integration/_files/Magento/TestModuleCatalogSearch/Model/SearchEngineVersionReader.php b/dev/tests/integration/_files/Magento/TestModuleCatalogSearch/Model/SearchEngineVersionReader.php index b565caae4e3fc..40563d428ac28 100644 --- a/dev/tests/integration/_files/Magento/TestModuleCatalogSearch/Model/SearchEngineVersionReader.php +++ b/dev/tests/integration/_files/Magento/TestModuleCatalogSearch/Model/SearchEngineVersionReader.php @@ -1,7 +1,7 @@ deploymentConfig = $deploymentConfig ?? \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->get(\Magento\Framework\App\DeploymentConfig::class); - $this->curl = new Curl(); + ->get(DeploymentConfig::class); + $this->curl = $curl ?? \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->get(Curl::class); $this->curl->setCredentials( $this->deploymentConfig->get(self::CONFIG_PATH_USER), $this->deploymentConfig->get(self::CONFIG_PATH_PASSWORD) diff --git a/dev/tests/integration/framework/Magento/TestFramework/Helper/Curl.php b/dev/tests/integration/framework/Magento/TestFramework/Helper/Curl.php index 62b753cf5d344..46766477e359d 100644 --- a/dev/tests/integration/framework/Magento/TestFramework/Helper/Curl.php +++ b/dev/tests/integration/framework/Magento/TestFramework/Helper/Curl.php @@ -1,30 +1,18 @@ makeRequest("DELETE", $uri); - } } diff --git a/lib/internal/Magento/Framework/HTTP/Client/Curl.php b/lib/internal/Magento/Framework/HTTP/Client/Curl.php index 7ba4fb915e294..28fa37d6d3c15 100644 --- a/lib/internal/Magento/Framework/HTTP/Client/Curl.php +++ b/lib/internal/Magento/Framework/HTTP/Client/Curl.php @@ -1,9 +1,8 @@ * @SuppressWarnings(PHPMD.ExcessiveClassComplexity) * @api */ @@ -223,6 +221,8 @@ public function removeCookies() * * @param string $uri uri relative to host, ex. "/index.php" * @return void + * + * @url https://www.rfc-editor.org/rfc/rfc9110.html#section-9.3.1 */ public function get($uri) { @@ -239,13 +239,109 @@ public function get($uri) * @param array|string $params * @return void * - * @see \Magento\Framework\HTTP\Client#post($uri, $params) + * @see \Magento\Framework\HTTP\Client::post($uri, $params) + * @url https://www.rfc-editor.org/rfc/rfc9110.html#section-9.3.3 */ public function post($uri, $params) { $this->makeRequest("POST", $uri, $params); } + /** + * Make PUT request + * + * @param string $uri + * @param array|string $params + * @return void + * + * @url https://www.rfc-editor.org/rfc/rfc9110.html#section-9.3.4 + */ + public function put(string $uri, string|array $params): void + { + $this->makeRequest("PUT", $uri, $params); + } + + /** + * Make DELETE request + * + * @param string $uri + * @param array|string $params + * @return void + * + * @url https://www.rfc-editor.org/rfc/rfc9110.html#section-9.3.5 + */ + public function delete(string $uri, array|string $params = []): void + { + $this->makeRequest("DELETE", $uri, $params); + } + + /** + * Make PATCH request + * + * @param string $uri + * @param array|string $params + * @return void + * + * @url https://www.rfc-editor.org/info/rfc5789 + */ + public function patch(string $uri, array|string $params): void + { + $this->makeRequest("PATCH", $uri, $params); + } + + /** + * Make OPTIONS request + * + * @param string $uri + * @param array|string $params + * @return void + * + * @url https://www.rfc-editor.org/rfc/rfc9110.html#section-9.3.7 + */ + public function options(string $uri, array|string $params = []): void + { + $this->makeRequest("OPTIONS", $uri, $params); + } + + /** + * Make HEAD request + * + * @param string $uri + * @return void + * + * @url https://www.rfc-editor.org/rfc/rfc9110.html#section-9.3.2 + */ + public function head(string $uri): void + { + $this->makeRequest("HEAD", $uri); + } + + /** + * Make TRACE request + * + * @param string $uri + * @return void + * + * @url https://www.rfc-editor.org/rfc/rfc9110.html#section-9.3.8 + */ + public function trace(string $uri): void + { + $this->makeRequest("TRACE", $uri); + } + + /** + * Make CONNECT request + * + * @param string $uri + * @return void + * + * @url https://www.rfc-editor.org/rfc/rfc9110.html#section-9.3.6 + */ + public function connect(string $uri): void + { + $this->makeRequest("CONNECT", $uri); + } + /** * Get response headers *