From 55547572aa574e8a15aee72bb46861f956f0ab3f Mon Sep 17 00:00:00 2001 From: Nyholm Date: Sun, 5 Aug 2018 11:43:31 +0200 Subject: [PATCH] Added bounce test --- tests/Api/Suppression/BounceTest.php | 90 ++++++++++++++++++++++++++++ tests/Api/SuppressionTest.php | 46 ++++++++++++++ 2 files changed, 136 insertions(+) create mode 100644 tests/Api/Suppression/BounceTest.php create mode 100644 tests/Api/SuppressionTest.php diff --git a/tests/Api/Suppression/BounceTest.php b/tests/Api/Suppression/BounceTest.php new file mode 100644 index 0000000..07b7e05 --- /dev/null +++ b/tests/Api/Suppression/BounceTest.php @@ -0,0 +1,90 @@ + + */ +class BounceTest extends TestCase +{ + public function testIndex() + { + $this->setRequestMethod('GET'); + $this->setRequestUri('/v3/example.com/bounces?limit=100'); + $this->setHydrateClass(IndexResponse::class); + + $api = $this->getApiInstance(); + $api->index('example.com'); + } + + public function testShow() + { + $this->setRequestMethod('GET'); + $this->setRequestUri('/v3/example.com/bounces/foo@bar.com'); + $this->setHydrateClass(ShowResponse::class); + + $api = $this->getApiInstance(); + $api->show('example.com', 'foo@bar.com'); + } + + public function testCreate() + { + $this->setRequestMethod('POST'); + $this->setRequestUri('/v3/example.com/bounces'); + $this->setHydrateClass(CreateResponse::class); + $this->setRequestBody([ + 'address' => 'foo@bar.com', + 'foo'=>'xxx', + ]); + + $api = $this->getApiInstance(); + $api->create('example.com', 'foo@bar.com', ['foo'=>'xxx']); + } + + + public function testDelete() + { + $this->setRequestMethod('DELETE'); + $this->setRequestUri('/v3/example.com/bounces/foo@bar.com'); + $this->setHydrateClass(DeleteResponse::class); + + $api = $this->getApiInstance(); + $api->show('example.com', 'foo@bar.com'); + } + + public function testDeleteAll() + { + $this->setRequestMethod('DELETE'); + $this->setRequestUri('/v3/example.com/bounces'); + $this->setHydrateClass(DeleteResponse::class); + + $api = $this->getApiInstance(); + $api->show('example.com'); + } + + /** + * {@inheritdoc} + */ + protected function getApiClass() + { + return Bounce::class; + } +} diff --git a/tests/Api/SuppressionTest.php b/tests/Api/SuppressionTest.php new file mode 100644 index 0000000..2e76cda --- /dev/null +++ b/tests/Api/SuppressionTest.php @@ -0,0 +1,46 @@ + + */ +class SuppressionTest extends TestCase +{ + public function testBounces() + { + $api = $this->getApiInstance(); + $this->assertInstanceOf(Suppression\Bounce::class, $api->bounces()); + } + + public function testComplaints() + { + $api = $this->getApiInstance(); + $this->assertInstanceOf(Suppression\Complaint::class, $api->complaints()); + } + + public function testUnsubscribes() + { + $api = $this->getApiInstance(); + $this->assertInstanceOf(Suppression\Unsubscribe::class, $api->unsubscribes()); + } + + /** + * {@inheritdoc} + */ + protected function getApiClass() + { + return Suppression::class; + } +}