Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: php-enqueue/enqueue-dev
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 0.10.9
Choose a base ref
...
head repository: php-enqueue/enqueue-dev
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 0.10.10
Choose a head ref
  • 11 commits
  • 8 files changed
  • 3 contributors

Commits on Mar 18, 2021

  1. [sns] added possibility to define already existing topics (prevent cr…

    …eate topic call) #1022
    Igor Paramonov committed Mar 18, 2021
    Copy the full SHA
    e162b21 View commit details
  2. [sns] fixed topic arns parse

    Igor Paramonov committed Mar 18, 2021
    Copy the full SHA
    9730b80 View commit details
  3. [sns] handled comments

    Igor Paramonov committed Mar 18, 2021
    Copy the full SHA
    5f0bd43 View commit details
  4. [sns] dummy commit, retry tests

    Igor Paramonov committed Mar 18, 2021
    Copy the full SHA
    74ea369 View commit details
  5. [sns] replaced custom parsing by dsn

    Igor Paramonov committed Mar 18, 2021
    Copy the full SHA
    daf511c View commit details
  6. [sns] replaced custom parsing by dsn

    Igor Paramonov committed Mar 18, 2021
    Copy the full SHA
    5b89211 View commit details
  7. [sns] another dummy commit - trigger rebuild

    Igor Paramonov committed Mar 18, 2021
    Copy the full SHA
    ef7b5c7 View commit details
  8. Merge pull request #1147 from paramonov/master

    [sns] added possibility to define already existing topics (prevent create topic call) #1022
    makasim authored Mar 18, 2021

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    7d3da26 View commit details

Commits on Mar 23, 2021

  1. [gps] Add support for consuming message from external publisher in no…

    …n-standard format
    Maciej Zgadzaj committed Mar 23, 2021
    Copy the full SHA
    ffe8590 View commit details

Commits on Mar 24, 2021

  1. Merge pull request #1118 from maciejzgadzaj/1117-consume-non-standard…

    …-message-format
    
    [gps] Add support for consuming message from external publisher in non-standard format
    makasim authored Mar 24, 2021

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    a465e51 View commit details
  2. Release 0.10.10

    Signed-off-by: Maksim Kotlyar <[email protected]>
    makasim committed Mar 24, 2021

    Verified

    This commit was signed with the committer’s verified signature.
    makasim Max Kotliar
    Copy the full SHA
    70e59d0 View commit details
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Change Log

## [0.10.10](https://github.com/php-enqueue/enqueue-dev/tree/0.10.10) (2021-03-24)
[Full Changelog](https://github.com/php-enqueue/enqueue-dev/compare/0.10.9...0.10.10)

**Merged pull requests:**

- \[sns\] added possibility to define already existing topics \(prevent create topic call\) \#1022 [\#1147](https://github.com/php-enqueue/enqueue-dev/pull/1147) ([paramonov](https://github.com/paramonov))
- \[gps\] Add support for consuming message from external publisher in non-standard format [\#1118](https://github.com/php-enqueue/enqueue-dev/pull/1118) ([maciejzgadzaj](https://github.com/maciejzgadzaj))

## [0.10.9](https://github.com/php-enqueue/enqueue-dev/tree/0.10.9) (2021-03-17)
[Full Changelog](https://github.com/php-enqueue/enqueue-dev/compare/0.10.8...0.10.9)

10 changes: 3 additions & 7 deletions pkg/gps/GpsMessage.php
Original file line number Diff line number Diff line change
@@ -157,15 +157,11 @@ public function jsonSerialize(): array
public static function jsonUnserialize(string $json): self
{
$data = json_decode($json, true);
if (JSON_ERROR_NONE !== json_last_error()) {
throw new \InvalidArgumentException(sprintf(
'The malformed json given. Error %s and message %s',
json_last_error(),
json_last_error_msg()
));
if (\JSON_ERROR_NONE !== json_last_error()) {
throw new \InvalidArgumentException(sprintf('The malformed json given. Error %s and message %s', json_last_error(), json_last_error_msg()));
}

return new self($data['body'], $data['properties'], $data['headers']);
return new self($data['body'] ?? $json, $data['properties'] ?? [], $data['headers'] ?? []);
}

public function getNativeMessage(): ?GoogleMessage
25 changes: 25 additions & 0 deletions pkg/gps/Tests/GpsMessageTest.php
Original file line number Diff line number Diff line change
@@ -38,6 +38,31 @@ public function testCouldBeUnserializedFromJson()
$this->assertEquals($message, $unserializedMessage);
}

public function testMessageEntityCouldBeUnserializedFromJson()
{
$json = '{"body":"theBody","properties":{"thePropFoo":"thePropFooVal"},"headers":{"theHeaderFoo":"theHeaderFooVal"}}';

$unserializedMessage = GpsMessage::jsonUnserialize($json);

$this->assertInstanceOf(GpsMessage::class, $unserializedMessage);
$decoded = json_decode($json, true);
$this->assertEquals($decoded['body'], $unserializedMessage->getBody());
$this->assertEquals($decoded['properties'], $unserializedMessage->getProperties());
$this->assertEquals($decoded['headers'], $unserializedMessage->getHeaders());
}

public function testMessagePayloadCouldBeUnserializedFromJson()
{
$json = '{"theBodyPropFoo":"theBodyPropVal"}';

$unserializedMessage = GpsMessage::jsonUnserialize($json);

$this->assertInstanceOf(GpsMessage::class, $unserializedMessage);
$this->assertEquals($json, $unserializedMessage->getBody());
$this->assertEquals([], $unserializedMessage->getProperties());
$this->assertEquals([], $unserializedMessage->getHeaders());
}

public function testThrowIfMalformedJsonGivenOnUnsterilizedFromJson()
{
$this->expectException(\InvalidArgumentException::class);
7 changes: 5 additions & 2 deletions pkg/sns/SnsConnectionFactory.php
Original file line number Diff line number Diff line change
@@ -24,13 +24,14 @@ class SnsConnectionFactory implements ConnectionFactory

/**
* $config = [
* 'key' => null AWS credentials. If no credentials are provided, the SDK will attempt to load them from the environment.
* 'key' => null, AWS credentials. If no credentials are provided, the SDK will attempt to load them from the environment.
* 'secret' => null, AWS credentials. If no credentials are provided, the SDK will attempt to load them from the environment.
* 'token' => null, AWS credentials. If no credentials are provided, the SDK will attempt to load them from the environment.
* 'region' => null, (string, required) Region to connect to. See http://docs.aws.amazon.com/general/latest/gr/rande.html for a list of available regions.
* 'version' => '2012-11-05', (string, required) The version of the webservice to utilize
* 'lazy' => true, Enable lazy connection (boolean)
* 'endpoint' => null (string, default=null) The full URI of the webservice. This is only required when connecting to a custom endpoint e.g. localstack
* 'endpoint' => null, (string, default=null) The full URI of the webservice. This is only required when connecting to a custom endpoint e.g. localstack
* 'topic_arns' => [], (array<string,string>) The list of existing topic arns: key - topic name; value - arn
* ].
*
* or
@@ -132,6 +133,7 @@ private function parseDsn(string $dsn): array
'version' => $dsn->getString('version'),
'lazy' => $dsn->getBool('lazy'),
'endpoint' => $dsn->getString('endpoint'),
'topic_arns' => $dsn->getArray('topic_arns', [])->toArray(),
]), function ($value) { return null !== $value; });
}

@@ -145,6 +147,7 @@ private function defaultConfig(): array
'version' => '2010-03-31',
'lazy' => true,
'endpoint' => null,
'topic_arns' => [],
];
}
}
3 changes: 1 addition & 2 deletions pkg/sns/SnsContext.php
Original file line number Diff line number Diff line change
@@ -35,8 +35,7 @@ public function __construct(SnsClient $client, array $config)
{
$this->client = $client;
$this->config = $config;

$this->topicArns = [];
$this->topicArns = $config['topic_arns'];
}

/**
24 changes: 24 additions & 0 deletions pkg/sns/Tests/SnsConnectionFactoryConfigTest.php
Original file line number Diff line number Diff line change
@@ -64,6 +64,7 @@ public static function provideConfigs()
'version' => '2010-03-31',
'lazy' => true,
'endpoint' => null,
'topic_arns' => [],
],
];

@@ -77,6 +78,7 @@ public static function provideConfigs()
'version' => '2010-03-31',
'lazy' => true,
'endpoint' => null,
'topic_arns' => [],
],
];

@@ -90,6 +92,7 @@ public static function provideConfigs()
'version' => '2010-03-31',
'lazy' => true,
'endpoint' => null,
'topic_arns' => [],
],
];

@@ -103,6 +106,7 @@ public static function provideConfigs()
'version' => '2010-03-31',
'lazy' => false,
'endpoint' => null,
'topic_arns' => [],
],
];

@@ -116,6 +120,7 @@ public static function provideConfigs()
'version' => '2010-03-31',
'lazy' => false,
'endpoint' => null,
'topic_arns' => [],
],
];

@@ -129,6 +134,7 @@ public static function provideConfigs()
'version' => '2010-03-31',
'lazy' => false,
'endpoint' => null,
'topic_arns' => [],
],
];

@@ -148,6 +154,24 @@ public static function provideConfigs()
'version' => '2010-03-31',
'lazy' => false,
'endpoint' => 'http://localstack:1111',
'topic_arns' => [],
],
];

yield [
['dsn' => 'sns:?topic_arns[topic1]=arn:aws:sns:us-east-1:123456789012:topic1&topic_arns[topic2]=arn:aws:sns:us-west-2:123456789012:topic2'],
[
'key' => null,
'secret' => null,
'token' => null,
'region' => null,
'version' => '2010-03-31',
'lazy' => true,
'endpoint' => null,
'topic_arns' => [
'topic1' => 'arn:aws:sns:us-east-1:123456789012:topic1',
'topic2' => 'arn:aws:sns:us-west-2:123456789012:topic2',
],
],
];
}
2 changes: 2 additions & 0 deletions pkg/sns/Tests/SnsConnectionFactoryTest.php
Original file line number Diff line number Diff line change
@@ -33,6 +33,7 @@ public function testCouldBeConstructedWithEmptyConfiguration()
'region' => null,
'version' => '2010-03-31',
'endpoint' => null,
'topic_arns' => [],
], 'config', $factory);
}

@@ -48,6 +49,7 @@ public function testCouldBeConstructedWithCustomConfiguration()
'region' => null,
'version' => '2010-03-31',
'endpoint' => null,
'topic_arns' => [],
], 'config', $factory);
}

2 changes: 1 addition & 1 deletion pkg/sns/Tests/Spec/SnsContextTest.php
Original file line number Diff line number Diff line change
@@ -20,6 +20,6 @@ protected function createContext()
{
$client = $this->createMock(SnsClient::class);

return new SnsContext($client, []);
return new SnsContext($client, ['topic_arns' => []]);
}
}