From 49939fbd8e09745e4d2dcdac3f64136f5aed3cc8 Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Sat, 28 Sep 2024 18:10:15 +0200 Subject: [PATCH] Remove testing against Guzzle 5 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Neither it nor the HttpPlug adapter is maintained upstream anymore: https://github.com/php-http/guzzle5-adapter#deprecated It also does not support async requests which we want to use eventually. Since trying to install the it in CI now causes dependency conflicts, let’s just stop supporting it like we did with Guzzle 6. --- .github/workflows/continuous-integration.yml | 39 -------------------- README.md | 17 +-------- phpstan.neon | 4 +- tests/Extractor/HttpClientTest.php | 8 ---- 4 files changed, 3 insertions(+), 65 deletions(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 986b020b..02a71900 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -131,45 +131,6 @@ jobs: - name: "Run PHPUnit" run: "php vendor/bin/simple-phpunit -v" - phpunit-guzzle5: - name: "PHPUnit (PHP ${{ matrix.php }} and Guzzle 5)" - runs-on: "ubuntu-20.04" - - strategy: - matrix: - php: - - "7.4" - - steps: - - name: "Checkout" - uses: "actions/checkout@v4" - with: - fetch-depth: 2 - - - name: "Install PHP" - uses: "shivammathur/setup-php@v2" - with: - php-version: "${{ matrix.php }}" - coverage: "none" - tools: composer:v2 - extensions: tidy - env: - COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: "Install dependencies with Composer" - uses: "ramsey/composer-install@v2" - - - name: "Setup adapter: Guzzle 5" - run: | - composer remove guzzlehttp/guzzle php-http/guzzle7-adapter --dev -n - composer require php-http/guzzle5-adapter --dev -n - - - name: "Setup logs" - run: "mkdir -p build/logs" - - - name: "Run PHPUnit" - run: "php vendor/bin/simple-phpunit -v" - phpunit-curl: name: "PHPUnit (PHP ${{ matrix.php }} and cURL)" runs-on: "ubuntu-20.04" diff --git a/README.md b/README.md index 1b702f2a..af8e31a1 100644 --- a/README.md +++ b/README.md @@ -59,10 +59,9 @@ Why `php-http/guzzle7-adapter`? Because Graby is decoupled from any HTTP client Graby is tested & should work great with: - Guzzle 7 (using `php-http/guzzle7-adapter`) -- Guzzle 5 (using `php-http/guzzle5-adapter`) - cURL (using `php-http/curl-client`) -Note: if you want to use Guzzle 6, use Graby 2 (support has dropped in v3 because of dependencies conflicts, which does not happen with Guzzle 5 :shrug:) +Note: if you want to use Guzzle 5 or 6, use Graby 2 (support has dropped in v3 because of dependencies conflicts) ### Retrieve content from an url @@ -193,20 +192,6 @@ $logs = $this->get('monolog.handler.graby')->getRecords(); If you need to define a timeout, you must create the `Http\Client\HttpClient` manually, configure it and inject it to `Graby\Graby`. -- For Guzzle 5: - - ```php - use Graby\Graby; - use GuzzleHttp\Client as GuzzleClient; - use Http\Adapter\Guzzle5\Client as GuzzleAdapter; - $guzzle = new GuzzleClient([ - 'defaults' => [ - 'timeout' => 2, - ] - ]); - $graby = new Graby([], new GuzzleAdapter($guzzle)); - ``` - - For Guzzle 7: ```php diff --git a/phpstan.neon b/phpstan.neon index 99fcfa3e..38d8d90e 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -9,9 +9,9 @@ parameters: - vendor/bin/.phpunit/phpunit/vendor/autoload.php ignoreErrors: - # because we check for some HTTP client to exist or not (Guzzle 5/6 & cURL) + # because we check for some HTTP client to exist or not (cURL) - - message: '#Http\\Adapter\\Guzzle5\\Client\\|Http\\Adapter\\Guzzle6\\Client\\|Http\\Client\\Curl\\Client given#' + message: '#Http\\Client\\Curl\\Client given#' path: %currentWorkingDirectory%/tests/Extractor/HttpClientTest.php # phpstan does not seem to recognize the class override for JSLikeHTMLElement - diff --git a/tests/Extractor/HttpClientTest.php b/tests/Extractor/HttpClientTest.php index 6b73f14d..c8637da1 100644 --- a/tests/Extractor/HttpClientTest.php +++ b/tests/Extractor/HttpClientTest.php @@ -266,14 +266,6 @@ public function testTimeout(): void $isGuzzle = true; $guzzle = new \GuzzleHttp\Client(['timeout' => 2]); $adapter = new \Http\Adapter\Guzzle7\Client($guzzle); - } elseif (class_exists('Http\Adapter\Guzzle6\Client')) { - $isGuzzle = true; - $guzzle = new \GuzzleHttp\Client(['timeout' => 2]); - $adapter = new \Http\Adapter\Guzzle6\Client($guzzle); - } elseif (class_exists('Http\Adapter\Guzzle5\Client')) { - $isGuzzle = true; - $guzzle = new \GuzzleHttp\Client(['defaults' => ['timeout' => 2]]); - $adapter = new \Http\Adapter\Guzzle5\Client($guzzle); } elseif (class_exists('Http\Client\Curl\Client')) { $isCurl = true; $adapter = new \Http\Client\Curl\Client(