Skip to content

Commit 42e2d09

Browse files
authored
Merge pull request #331 from alcalyn/patch-1
Fix Call to undefined function GuzzleHttp\Psr7\modify_request()
2 parents 1296815 + 8723ea4 commit 42e2d09

File tree

7 files changed

+17
-20
lines changed

7 files changed

+17
-20
lines changed

src/Common/Auth/AuthHandler.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
namespace OpenStack\Common\Auth;
66

7-
use function GuzzleHttp\Psr7\modify_request;
7+
use GuzzleHttp\Psr7\Utils;
88
use Psr\Http\Message\RequestInterface;
99

1010
/**
@@ -53,7 +53,7 @@ public function __invoke(RequestInterface $request, array $options)
5353

5454
$modify = ['set_headers' => ['X-Auth-Token' => $this->token->getId()]];
5555

56-
return $fn(modify_request($request, $modify), $options);
56+
return $fn(Utils::modifyRequest($request, $modify), $options);
5757
}
5858

5959
/**

tests/unit/Common/Api/OperatorTraitTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace OpenStack\Test\Common\Api;
44

5-
use function GuzzleHttp\Psr7\uri_for;
65
use GuzzleHttp\Promise\Promise;
76
use GuzzleHttp\Psr7\Response;
87
use OpenStack\Common\Api\Operation;

tests/unit/Common/Error/BuilderTest.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,11 @@
22

33
namespace OpenStack\Test\Common\Error;
44

5-
use function GuzzleHttp\Psr7\stream_for;
6-
use function GuzzleHttp\Psr7\str;
7-
85
use GuzzleHttp\ClientInterface;
96
use GuzzleHttp\Exception\ClientException;
107
use GuzzleHttp\Psr7\Request;
118
use GuzzleHttp\Psr7\Response;
9+
use GuzzleHttp\Psr7\Utils;
1210
use OpenStack\Common\Error\BadResponseError;
1311
use OpenStack\Common\Error\Builder;
1412
use OpenStack\Common\Error\UserInputError;
@@ -32,7 +30,7 @@ public function test_it_injects_client()
3230
public function test_it_builds_http_errors()
3331
{
3432
$request = new Request('POST', '/servers');
35-
$response = new Response(400, [], stream_for('Invalid parameters'));
33+
$response = new Response(400, [], Utils::streamFor('Invalid parameters'));
3634

3735
$requestStr = trim($this->builder->str($request));
3836
$responseStr = trim($this->builder->str($response));

tests/unit/Common/Resource/AbstractResourceTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
namespace OpenStack\Test\Common\Resource;
44

55
use GuzzleHttp\Psr7\Response;
6-
use function GuzzleHttp\Psr7\stream_for;
6+
use GuzzleHttp\Psr7\Utils;
77
use OpenStack\Common\Resource\AbstractResource;
88
use OpenStack\Common\Resource\Alias;
99
use OpenStack\Common\Resource\ResourceInterface;
@@ -25,7 +25,7 @@ public function setUp(): void
2525

2626
public function test_it_populates_from_response()
2727
{
28-
$response = new Response(200, ['Content-Type' => 'application/json'], stream_for(
28+
$response = new Response(200, ['Content-Type' => 'application/json'], Utils::streamFor(
2929
json_encode(['foo' => ['bar' => '1']])
3030
));
3131

tests/unit/Common/Transport/UtilsTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,26 @@
33
namespace OpenStack\Test\Common\Transport;
44

55
use GuzzleHttp\Psr7\Response;
6-
use function GuzzleHttp\Psr7\uri_for;
76
use GuzzleHttp\Psr7\Uri;
7+
use GuzzleHttp\Psr7\Utils as Psr7Utils;
88
use OpenStack\Common\Transport\Utils;
99
use OpenStack\Test\TestCase;
1010

1111
class UtilsTest extends TestCase
1212
{
1313
public function test_decoding_malformed_json_throws_error()
1414
{
15-
$response = new Response(200, [], \GuzzleHttp\Psr7\stream_for('{'));
15+
$response = new Response(200, [], Psr7Utils::streamFor('{'));
1616
$this->expectException(\InvalidArgumentException::class);
1717

1818
Utils::jsonDecode($response);
1919
}
2020

2121
public function test_it_adds_paths()
2222
{
23-
$uri = Utils::addPaths(uri_for('http://openstack.org/foo'), 'bar', 'baz', '1', '2');
23+
$uri = Utils::addPaths(Psr7Utils::uriFor('http://openstack.org/foo'), 'bar', 'baz', '1', '2');
2424

2525
self::assertInstanceOf(Uri::class, $uri);
26-
self::assertEquals(uri_for('http://openstack.org/foo/bar/baz/1/2'), $uri);
26+
self::assertEquals(Psr7Utils::uriFor('http://openstack.org/foo/bar/baz/1/2'), $uri);
2727
}
2828
}

tests/unit/ObjectStore/v1/Models/ObjectTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
namespace OpenStack\Test\ObjectStore\v1\Models;
44

5-
use function GuzzleHttp\Psr7\uri_for;
65
use GuzzleHttp\Psr7\Stream;
6+
use GuzzleHttp\Psr7\Utils;
77
use OpenStack\ObjectStore\v1\Api;
88
use OpenStack\ObjectStore\v1\Models\StorageObject;
99
use OpenStack\Test\TestCase;
@@ -128,11 +128,11 @@ public function test_It_Gets_Public_Uri()
128128
{
129129
$this->client->getConfig('base_uri')
130130
->shouldBeCalled()
131-
->willReturn(uri_for('myopenstack.org:9000/tenantId'));
131+
->willReturn(Utils::uriFor('myopenstack.org:9000/tenantId'));
132132

133133
$this->object->containerName = 'foo';
134134
$this->object->name = 'bar';
135135

136-
self::assertEquals(uri_for('myopenstack.org:9000/tenantId/foo/bar'), $this->object->getPublicUri());
136+
self::assertEquals(Utils::uriFor('myopenstack.org:9000/tenantId/foo/bar'), $this->object->getPublicUri());
137137
}
138138
}

tests/unit/TestCase.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
namespace OpenStack\Test;
44

5-
use function GuzzleHttp\Psr7\stream_for;
6-
use function GuzzleHttp\Psr7\parse_response;
75
use GuzzleHttp\ClientInterface;
6+
use GuzzleHttp\Psr7\Message;
87
use GuzzleHttp\Psr7\Response;
8+
use GuzzleHttp\Psr7\Utils;
99
use Prophecy\Argument;
1010

1111
abstract class TestCase extends \PHPUnit\Framework\TestCase
@@ -25,7 +25,7 @@ protected function setUp(): void
2525

2626
protected function createResponse($status, array $headers, array $json)
2727
{
28-
return new Response($status, $headers, stream_for(json_encode($json)));
28+
return new Response($status, $headers, Utils::streamFor(json_encode($json)));
2929
}
3030

3131
protected function getFixture($file)
@@ -40,7 +40,7 @@ protected function getFixture($file)
4040
throw new \RuntimeException(sprintf("%s does not exist", $path));
4141
}
4242

43-
return parse_response(file_get_contents($path));
43+
return Message::parseResponse(file_get_contents($path));
4444
}
4545

4646
protected function setupMock($method, $path, $body = null, array $headers = [], $response = null)

0 commit comments

Comments
 (0)