[Messenger] fix ignore account & endpoint options amazon sqs connection
This commit is contained in:
parent
08ff65fcb5
commit
fc90a3b7c6
@ -139,6 +139,16 @@ class ConnectionTest extends TestCase
|
||||
);
|
||||
}
|
||||
|
||||
public function testFromDsnWithAccountAndEndpointOption()
|
||||
{
|
||||
$httpClient = $this->getMockBuilder(HttpClientInterface::class)->getMock();
|
||||
|
||||
$this->assertEquals(
|
||||
new Connection(['account' => 12345], new SqsClient(['endpoint' => 'https://custom-endpoint.tld', 'region' => 'eu-west-1', 'accessKeyId' => null, 'accessKeySecret' => null], null, $httpClient)),
|
||||
Connection::fromDsn('sqs://default', ['endpoint' => 'https://custom-endpoint.tld', 'account' => 12345], $httpClient)
|
||||
);
|
||||
}
|
||||
|
||||
public function testKeepGettingPendingMessages()
|
||||
{
|
||||
$client = $this->createMock(SqsClient::class);
|
||||
|
@ -117,13 +117,15 @@ class Connection
|
||||
$clientConfiguration['region'] = $matches[1];
|
||||
}
|
||||
unset($query['sslmode']);
|
||||
} elseif (self::DEFAULT_OPTIONS['endpoint'] !== $options['endpoint'] ?? self::DEFAULT_OPTIONS['endpoint']) {
|
||||
$clientConfiguration['endpoint'] = $options['endpoint'];
|
||||
}
|
||||
|
||||
$parsedPath = explode('/', ltrim($parsedUrl['path'] ?? '/', '/'));
|
||||
if (\count($parsedPath) > 0 && !empty($queueName = end($parsedPath))) {
|
||||
$configuration['queue_name'] = $queueName;
|
||||
}
|
||||
$configuration['account'] = 2 === \count($parsedPath) ? $parsedPath[0] : null;
|
||||
$configuration['account'] = 2 === \count($parsedPath) ? $parsedPath[0] : $options['account'] ?? self::DEFAULT_OPTIONS['account'];
|
||||
|
||||
// check for extra keys in options
|
||||
$optionsExtraKeys = array_diff(array_keys($options), array_keys(self::DEFAULT_OPTIONS));
|
||||
|
Reference in New Issue
Block a user