From 0568fa5168b39a48362a46db5638a5d0f586632f Mon Sep 17 00:00:00 2001 From: Alexander Kozienko Date: Tue, 19 Feb 2019 13:24:41 +0200 Subject: [PATCH] snsqs tests --- SnsClient.php | 7 +++++++ SnsContext.php | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/SnsClient.php b/SnsClient.php index 133f43f..2d33faf 100644 --- a/SnsClient.php +++ b/SnsClient.php @@ -38,6 +38,13 @@ public function createTopic(array $args): Result return $this->callApi('createTopic', $args); } + public function deleteTopic(string $topicArn): Result + { + return $this->callApi('DeleteTopic', [ + 'TopicArn' => $topicArn, + ]); + } + public function publish(array $args): Result { return $this->callApi('publish', $args); diff --git a/SnsContext.php b/SnsContext.php index 02bcfd1..b489f8d 100644 --- a/SnsContext.php +++ b/SnsContext.php @@ -77,6 +77,13 @@ public function declareTopic(SnsDestination $destination): void $this->topicArns[$destination->getTopicName()] = (string) $result->get('TopicArn'); } + public function deleteTopic(SnsDestination $destination): void + { + $this->client->deleteTopic($this->getTopicArn($destination)); + + unset($this->topicArns[$destination->getTopicName()]); + } + public function subscribe(SnsSubscribe $subscribe): void { foreach ($this->getSubscriptions($subscribe->getTopic()) as $subscription) {