From 5d6218dcbac877083dc6af6cd37f99455a96934f Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Tue, 5 Sep 2023 20:43:43 +0200 Subject: [PATCH] [ticket/17176] Use NativeHttpClient on windows builds PHPBB3-17176 --- .github/workflows/tests.yml | 2 +- tests/test_framework/phpbb_functional_test_case.php | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b99609f4e2..687d4b04a0 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -583,7 +583,7 @@ jobs: if: ${{ matrix.type == 'unit' }} run: | phpBB/vendor/bin/phpunit --configuration .github/phpunit-psql-windows-github.xml --verbose --stop-on-error --exclude-group functional - - name: Run unit tests + - name: Run functional tests if: ${{ matrix.type == 'functional' }} run: | phpBB/vendor/bin/phpunit --configuration .github/phpunit-psql-windows-github.xml --verbose --stop-on-error --group functional diff --git a/tests/test_framework/phpbb_functional_test_case.php b/tests/test_framework/phpbb_functional_test_case.php index e21258256c..89f0762ded 100644 --- a/tests/test_framework/phpbb_functional_test_case.php +++ b/tests/test_framework/phpbb_functional_test_case.php @@ -13,12 +13,14 @@ use Symfony\Component\BrowserKit\CookieJar; use Symfony\Component\BrowserKit\HttpBrowser; use Symfony\Component\HttpClient\HttpClient; +use Symfony\Component\HttpClient\NativeHttpClient; +use Symfony\Contracts\HttpClient\HttpClientInterface; require_once __DIR__ . '/mock/phpbb_mock_null_installer_task.php'; class phpbb_functional_test_case extends phpbb_test_case { - /** @var HttpClient */ + /** @var HttpClientInterface */ protected static $http_client; /** @var HttpBrowser */ @@ -94,7 +96,8 @@ class phpbb_functional_test_case extends phpbb_test_case $this->bootstrap(); self::$cookieJar = new CookieJar; - self::$http_client = HttpClient::create(); + // Force native client on windows platform + self::$http_client = strtolower(substr(PHP_OS, 0, 3)) === 'win' ? new NativeHttpClient() : HttpClient::create(); self::$client = new HttpBrowser(self::$http_client, null, self::$cookieJar); // Clear the language array so that things