This commit is contained in:
Nyholm 2018-08-05 12:00:05 +02:00 committed by David Garcia
parent 1ed1c2557c
commit 1835bc28d7
9 changed files with 27 additions and 58 deletions

View File

@ -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);
@ -136,6 +133,7 @@ JSON
$api = $this->getApiInstance();
$api->updateCredential('example.com', 'foo', 'barbar');
}
public function testDeleteCredential()
{
$this->setRequestMethod('DELETE');
@ -170,7 +168,6 @@ JSON
$api->updateConnection('example.com', true, false);
}
public function testVerify()
{
$this->setRequestMethod('PUT');
@ -180,6 +177,4 @@ JSON
$api = $this->getApiInstance();
$api->verify('example.com');
}
}

View File

@ -40,9 +40,8 @@ class MessageTest extends TestCase
'text' => 'Test',
'attachment' => [
['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);

View File

@ -52,7 +52,6 @@ class RouteTest extends TestCase
$api->create('catch_all()', ['forward("mailbox@myapp.com")'], 'example', 100);
}
public function testUpdate()
{
$this->setRequestMethod('PUT');

View File

@ -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 <tobias.nyholm@gmail.com>
*/
class BounceTest extends TestCase
@ -59,7 +54,6 @@ class BounceTest extends TestCase
$api->create('example.com', 'foo@bar.com', ['foo' => 'xxx']);
}
public function testDelete()
{
$this->setRequestMethod('DELETE');

View File

@ -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 <tobias.nyholm@gmail.com>
*/
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');

View File

@ -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 <tobias.nyholm@gmail.com>
*/
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');

View File

@ -12,8 +12,6 @@ namespace Mailgun\Tests\Api;
use Mailgun\Api\Suppression;
/**
*
*
* @author Tobias Nyholm <tobias.nyholm@gmail.com>
*/
class SuppressionTest extends TestCase

View File

@ -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()

View File

@ -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()
@ -99,7 +98,6 @@ class WebhookTest extends TestCase
$api->update('example.com', '4711', 'url');
}
public function testDelete()
{
$this->setRequestMethod('DELETE');