From 2395fa0e1c75131ca78d64afd669c273f817f270 Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Sat, 23 May 2026 23:06:15 +0100 Subject: [PATCH] Require patched Guzzle and PSR-7 versions --- composer.json | 4 ++-- samples/Images/v2/images/upload_binary_data.php | 4 +--- tests/unit/Common/Resource/OperatorResourceTest.php | 4 +--- tests/unit/Images/v2/Models/ImageTest.php | 12 +++--------- tests/unit/Images/v2/ServiceTest.php | 8 ++------ tests/unit/ObjectStore/v1/Models/ContainerTest.php | 4 +--- 6 files changed, 10 insertions(+), 26 deletions(-) diff --git a/composer.json b/composer.json index f8658c8b..1bf0e643 100644 --- a/composer.json +++ b/composer.json @@ -28,8 +28,8 @@ "homepage": "https://github.com/php-opencloud/openstack", "require": { "php": "^7.2.5 || ^8.0", - "guzzlehttp/guzzle": "^7.0", - "guzzlehttp/psr7": ">=1.7", + "guzzlehttp/guzzle": "^7.5.1", + "guzzlehttp/psr7": "^1.9.1 || ^2.4.5", "guzzlehttp/uri-template": "^0.2 || ^1.0", "justinrainbow/json-schema": "^5.2 || ^6.0" }, diff --git a/samples/Images/v2/images/upload_binary_data.php b/samples/Images/v2/images/upload_binary_data.php index ef5018a1..c59fa6f3 100644 --- a/samples/Images/v2/images/upload_binary_data.php +++ b/samples/Images/v2/images/upload_binary_data.php @@ -15,8 +15,6 @@ $image = $service->getImage('{imageId}'); -$stream = function_exists('\GuzzleHttp\Psr7\stream_for') - ? \GuzzleHttp\Psr7\stream_for(fopen('{fileName}', 'r')) - : \GuzzleHttp\Psr7\Utils::streamFor(fopen('{fileName}', 'r')); +$stream = \GuzzleHttp\Psr7\Utils::streamFor(fopen('{fileName}', 'r')); $image->uploadData($stream); diff --git a/tests/unit/Common/Resource/OperatorResourceTest.php b/tests/unit/Common/Resource/OperatorResourceTest.php index f90841a1..fab5c24c 100644 --- a/tests/unit/Common/Resource/OperatorResourceTest.php +++ b/tests/unit/Common/Resource/OperatorResourceTest.php @@ -28,9 +28,7 @@ public function setUp(): void public function test_it_retrieves_base_http_url() { - $returnedUri = function_exists('\GuzzleHttp\Psr7\uri_for') - ? \GuzzleHttp\Psr7\uri_for('http://foo.com') - : \GuzzleHttp\Psr7\Utils::uriFor('http://foo.com'); + $returnedUri = \GuzzleHttp\Psr7\Utils::uriFor('http://foo.com'); $this->client->getConfig('base_uri')->shouldBeCalled()->willReturn($returnedUri); $uri = $this->resource->testBaseUri(); diff --git a/tests/unit/Images/v2/Models/ImageTest.php b/tests/unit/Images/v2/Models/ImageTest.php index 02e0428b..a0d6e12b 100644 --- a/tests/unit/Images/v2/Models/ImageTest.php +++ b/tests/unit/Images/v2/Models/ImageTest.php @@ -30,9 +30,7 @@ public function setUp(): void public function test_it_retrieves() { - $returnedUri = function_exists('\GuzzleHttp\Psr7\uri_for') - ? \GuzzleHttp\Psr7\uri_for('') - : \GuzzleHttp\Psr7\Utils::uriFor(''); + $returnedUri = \GuzzleHttp\Psr7\Utils::uriFor(''); $this->client->getConfig('base_uri')->shouldBeCalled()->willReturn($returnedUri); @@ -127,9 +125,7 @@ public function test_it_deactivates() public function test_it_uploads_data_stream() { - $stream = function_exists('\GuzzleHttp\Psr7\stream_for') - ? \GuzzleHttp\Psr7\stream_for('data') - : \GuzzleHttp\Psr7\Utils::streamFor('data'); + $stream = \GuzzleHttp\Psr7\Utils::streamFor('data'); $headers = ['Content-Type' => 'application/octet-stream']; @@ -140,9 +136,7 @@ public function test_it_uploads_data_stream() public function test_it_downloads_data() { - $stream = function_exists('\GuzzleHttp\Psr7\stream_for') - ? \GuzzleHttp\Psr7\stream_for('data') - : \GuzzleHttp\Psr7\Utils::streamFor('data'); + $stream = \GuzzleHttp\Psr7\Utils::streamFor('data'); $headers = ['Content-Type' => 'application/octet-stream']; $response = new Response(200, $headers, $stream); diff --git a/tests/unit/Images/v2/ServiceTest.php b/tests/unit/Images/v2/ServiceTest.php index d3faee95..64077583 100644 --- a/tests/unit/Images/v2/ServiceTest.php +++ b/tests/unit/Images/v2/ServiceTest.php @@ -23,9 +23,7 @@ public function setUp(): void public function test_it_creates_image() { - $returnedUri = function_exists('\GuzzleHttp\Psr7\uri_for') - ? \GuzzleHttp\Psr7\uri_for('') - : \GuzzleHttp\Psr7\Utils::uriFor(''); + $returnedUri = \GuzzleHttp\Psr7\Utils::uriFor(''); $this->client ->getConfig('base_uri') @@ -62,9 +60,7 @@ public function test_it_creates_image() public function test_it_lists_images() { - $returnedUri = function_exists('\GuzzleHttp\Psr7\uri_for') - ? \GuzzleHttp\Psr7\uri_for('') - : \GuzzleHttp\Psr7\Utils::uriFor(''); + $returnedUri = \GuzzleHttp\Psr7\Utils::uriFor(''); $this->client ->getConfig('base_uri') diff --git a/tests/unit/ObjectStore/v1/Models/ContainerTest.php b/tests/unit/ObjectStore/v1/Models/ContainerTest.php index 0106bdda..35d595a1 100644 --- a/tests/unit/ObjectStore/v1/Models/ContainerTest.php +++ b/tests/unit/ObjectStore/v1/Models/ContainerTest.php @@ -226,9 +226,7 @@ public function test_valid_segment_index_format() public function test_it_chunks_according_to_provided_segment_size() { - $stream = function_exists('\GuzzleHttp\Psr7\stream_for') - ? \GuzzleHttp\Psr7\stream_for(implode('', range('A', 'X'))) - : \GuzzleHttp\Psr7\Utils::streamFor(implode('', range('A', 'X'))); + $stream = \GuzzleHttp\Psr7\Utils::streamFor(implode('', range('A', 'X'))); $data = [ 'name' => 'object',