diff --git a/tests/Api/DomainTest.php b/tests/Api/DomainTest.php index bc2198e..62657c9 100644 --- a/tests/Api/DomainTest.php +++ b/tests/Api/DomainTest.php @@ -11,8 +11,6 @@ namespace Mailgun\Tests\Api; use GuzzleHttp\Psr7\Response; use Mailgun\Api\Domain; -use Mailgun\Api\Event; -use Mailgun\Exception\InvalidArgumentException; use Mailgun\Model\Domain\ConnectionResponse; use Mailgun\Model\Domain\CreateCredentialResponse; use Mailgun\Model\Domain\CreateResponse; @@ -23,7 +21,6 @@ use Mailgun\Model\Domain\ShowResponse; use Mailgun\Model\Domain\UpdateConnectionResponse; use Mailgun\Model\Domain\UpdateCredentialResponse; use Mailgun\Model\Domain\VerifyResponse; -use Mailgun\Model\Event\EventResponse; class DomainTest extends TestCase { @@ -77,7 +74,7 @@ JSON $this->setRequestMethod('POST'); $this->setRequestUri('/v3/domains'); $this->setRequestBody([ - 'name'=>'example.com' + 'name' => 'example.com', ]); $this->setHydrateClass(CreateResponse::class); @@ -90,9 +87,9 @@ JSON $this->setRequestMethod('POST'); $this->setRequestUri('/v3/domains'); $this->setRequestBody([ - 'name'=>'example.com', - 'smtp_password'=>'foo', - 'spam_action'=>'bar', + 'name' => 'example.com', + 'smtp_password' => 'foo', + 'spam_action' => 'bar', ]); $this->setHydrateClass(CreateResponse::class); @@ -136,6 +133,7 @@ JSON $api = $this->getApiInstance(); $api->updateCredential('example.com', 'foo', 'barbar'); } + public function testDeleteCredential() { $this->setRequestMethod('DELETE'); @@ -167,10 +165,9 @@ JSON $this->setHydrateClass(UpdateConnectionResponse::class); $api = $this->getApiInstance(); - $api->updateConnection('example.com', true , false); + $api->updateConnection('example.com', true, false); } - public function testVerify() { $this->setRequestMethod('PUT'); @@ -180,6 +177,4 @@ JSON $api = $this->getApiInstance(); $api->verify('example.com'); } - - } diff --git a/tests/Api/MessageTest.php b/tests/Api/MessageTest.php index f926cbd..6830600 100644 --- a/tests/Api/MessageTest.php +++ b/tests/Api/MessageTest.php @@ -25,24 +25,23 @@ class MessageTest extends TestCase $this->setRequestUri('/v3/example.com/messages'); $this->setHydrateClass(SendResponse::class); $this->setRequestBody([ - 'from' => 'bob@example.com', - 'to' => 'sally@example.com', + 'from' => 'bob@example.com', + 'to' => 'sally@example.com', 'subject' => 'Test file path attachments', - 'text' => 'Test', + 'text' => 'Test', 'attachment' => 'resource', ]); $api = $this->getApiInstance(); $api->send('example.com', [ - 'from' => 'bob@example.com', - 'to' => 'sally@example.com', + 'from' => 'bob@example.com', + 'to' => 'sally@example.com', 'subject' => 'Test file path attachments', - 'text' => 'Test', + 'text' => 'Test', 'attachment' => [ - ['filePath'=>__DIR__.'/../TestAssets/mailgun_icon1.png', 'filename'=>'mailgun_icon1.png'], - ] + ['filePath' => __DIR__.'/../TestAssets/mailgun_icon1.png', 'filename' => 'mailgun_icon1.png'], + ], ]); - } public function testSendMime() @@ -104,7 +103,7 @@ class MessageTest extends TestCase $this->setRequestMethod('GET'); $this->setRequestUri('url'); $this->setRequestHeaders([ - 'Accept' => 'message/rfc2822' + 'Accept' => 'message/rfc2822', ]); $this->setHydrateClass(ShowResponse::class); diff --git a/tests/Api/RouteTest.php b/tests/Api/RouteTest.php index 6dd3a8b..69f9ef0 100644 --- a/tests/Api/RouteTest.php +++ b/tests/Api/RouteTest.php @@ -52,7 +52,6 @@ class RouteTest extends TestCase $api->create('catch_all()', ['forward("mailbox@myapp.com")'], 'example', 100); } - public function testUpdate() { $this->setRequestMethod('PUT'); diff --git a/tests/Api/Suppression/BounceTest.php b/tests/Api/Suppression/BounceTest.php index ef31dbe..3f2bd05 100644 --- a/tests/Api/Suppression/BounceTest.php +++ b/tests/Api/Suppression/BounceTest.php @@ -9,18 +9,13 @@ namespace Mailgun\Tests\Api; - - use Mailgun\Api\Suppression\Bounce; use Mailgun\Model\Suppression\Bounce\CreateResponse; use Mailgun\Model\Suppression\Bounce\DeleteResponse; use Mailgun\Model\Suppression\Bounce\IndexResponse; use Mailgun\Model\Suppression\Bounce\ShowResponse; - /** - * - * * @author Tobias Nyholm */ class BounceTest extends TestCase @@ -52,14 +47,13 @@ class BounceTest extends TestCase $this->setHydrateClass(CreateResponse::class); $this->setRequestBody([ 'address' => 'foo@bar.com', - 'foo'=>'xxx', + 'foo' => 'xxx', ]); $api = $this->getApiInstance(); - $api->create('example.com', 'foo@bar.com', ['foo'=>'xxx']); + $api->create('example.com', 'foo@bar.com', ['foo' => 'xxx']); } - public function testDelete() { $this->setRequestMethod('DELETE'); diff --git a/tests/Api/Suppression/ComplaintTest.php b/tests/Api/Suppression/ComplaintTest.php index 7eaf62d..6025798 100644 --- a/tests/Api/Suppression/ComplaintTest.php +++ b/tests/Api/Suppression/ComplaintTest.php @@ -9,18 +9,13 @@ namespace Mailgun\Tests\Api; - - use Mailgun\Api\Suppression\Complaint; use Mailgun\Model\Suppression\Complaint\CreateResponse; use Mailgun\Model\Suppression\Complaint\DeleteResponse; use Mailgun\Model\Suppression\Complaint\IndexResponse; use Mailgun\Model\Suppression\Complaint\ShowResponse; - /** - * - * * @author Tobias Nyholm */ class ComplaintTest extends TestCase @@ -58,7 +53,6 @@ class ComplaintTest extends TestCase $api->create('example.com', 'foo@bar.com'); } - public function testDelete() { $this->setRequestMethod('DELETE'); diff --git a/tests/Api/Suppression/UnsubscribeTest.php b/tests/Api/Suppression/UnsubscribeTest.php index d048f7c..0a21cf3 100644 --- a/tests/Api/Suppression/UnsubscribeTest.php +++ b/tests/Api/Suppression/UnsubscribeTest.php @@ -9,18 +9,13 @@ namespace Mailgun\Tests\Api; - - use Mailgun\Api\Suppression\Unsubscribe; use Mailgun\Model\Suppression\Unsubscribe\CreateResponse; use Mailgun\Model\Suppression\Unsubscribe\DeleteResponse; use Mailgun\Model\Suppression\Unsubscribe\IndexResponse; use Mailgun\Model\Suppression\Unsubscribe\ShowResponse; - /** - * - * * @author Tobias Nyholm */ class UnsubscribeTest extends TestCase @@ -58,7 +53,6 @@ class UnsubscribeTest extends TestCase $api->create('example.com', 'foo@bar.com'); } - public function testDelete() { $this->setRequestMethod('DELETE'); diff --git a/tests/Api/SuppressionTest.php b/tests/Api/SuppressionTest.php index 2e76cda..38d5c65 100644 --- a/tests/Api/SuppressionTest.php +++ b/tests/Api/SuppressionTest.php @@ -12,8 +12,6 @@ namespace Mailgun\Tests\Api; use Mailgun\Api\Suppression; /** - * - * * @author Tobias Nyholm */ class SuppressionTest extends TestCase diff --git a/tests/Api/TestCase.php b/tests/Api/TestCase.php index 83a8e02..b78182f 100644 --- a/tests/Api/TestCase.php +++ b/tests/Api/TestCase.php @@ -11,7 +11,6 @@ namespace Mailgun\Tests\Api; use GuzzleHttp\Psr7\Request; use GuzzleHttp\Psr7\Response; -use Mailgun\Api\Webhook; use Mailgun\Hydrator\ModelHydrator; use Mailgun\Mailgun; use Psr\Http\Message\ResponseInterface; @@ -145,7 +144,7 @@ abstract class TestCase extends \PHPUnit_Framework_TestCase $class = $this->getApiClass(); - if ($apiKey !== null) { + if (null !== $apiKey) { return new $class($httpClient, $requestClient, $hydrator, $apiKey); } @@ -182,7 +181,7 @@ abstract class TestCase extends \PHPUnit_Framework_TestCase // Check every item in body. foreach ($body as $item) { - if ($this->requestBody[$item['name']] === 'resource' && is_resource($item['content'])) { + if ('resource' === $this->requestBody[$item['name']] && is_resource($item['content'])) { continue; } if ($this->requestBody[$item['name']] !== $item['content']) { @@ -191,7 +190,6 @@ abstract class TestCase extends \PHPUnit_Framework_TestCase } return true; - } protected function getMailgunClient() diff --git a/tests/Api/WebhookTest.php b/tests/Api/WebhookTest.php index 71d2c2c..2c05321 100644 --- a/tests/Api/WebhookTest.php +++ b/tests/Api/WebhookTest.php @@ -16,7 +16,6 @@ use Mailgun\Model\Webhook\CreateResponse; use Mailgun\Model\Webhook\DeleteResponse; use Mailgun\Model\Webhook\UpdateResponse; - class WebhookTest extends TestCase { protected function getApiClass() @@ -28,9 +27,9 @@ class WebhookTest extends TestCase { $api = $this->getApiInstance('key-3ax6xnjp29jd6fds4gc373sgvjxteol0'); - $timestamp = '1403645220'; - $token = '5egbgr1vjgqxtrnp65xfznchgdccwh5d6i09vijqi3whgowmn6'; - $signature = '9cfc5c41582e51246e73c88d34db3af0a3a2692a76fbab81492842f000256d33'; + $timestamp = '1403645220'; + $token = '5egbgr1vjgqxtrnp65xfznchgdccwh5d6i09vijqi3whgowmn6'; + $signature = '9cfc5c41582e51246e73c88d34db3af0a3a2692a76fbab81492842f000256d33'; $this->assertTrue($api->verifyWebhookSignature($timestamp, $token, $signature)); } @@ -38,9 +37,9 @@ class WebhookTest extends TestCase public function testVerifyWebhookBad() { $api = $this->getApiInstance('key-3ax6xnjp29jd6fds4gc373sgvjxteol0'); - $timestamp = '1403645220'; - $token = 'owyldpe6nxhmrn78epljl6bj0orrki1u3d2v5e6cnlmmuox8jr'; - $signature = '9cfc5c41582e51246e73c88d34db3af0a3a2692a76fbab81492842f000256d33'; + $timestamp = '1403645220'; + $token = 'owyldpe6nxhmrn78epljl6bj0orrki1u3d2v5e6cnlmmuox8jr'; + $signature = '9cfc5c41582e51246e73c88d34db3af0a3a2692a76fbab81492842f000256d33'; $this->assertFalse($api->verifyWebhookSignature($timestamp, $token, $signature)); } @@ -79,7 +78,7 @@ class WebhookTest extends TestCase $this->setHydrateClass(CreateResponse::class); $this->setRequestBody([ 'id' => '4711', - 'url'=>'url', + 'url' => 'url', ]); $api = $this->getApiInstance('key'); @@ -92,14 +91,13 @@ class WebhookTest extends TestCase $this->setRequestUri('/v3/domains/example.com/webhooks/4711'); $this->setHydrateClass(UpdateResponse::class); $this->setRequestBody([ - 'url'=>'url', + 'url' => 'url', ]); $api = $this->getApiInstance('key'); $api->update('example.com', '4711', 'url'); } - public function testDelete() { $this->setRequestMethod('DELETE');