mirror of
https://github.com/retailcrm/mailgun-php.git
synced 2024-11-22 04:26:02 +03:00
Fixed integration tests (#233)
* Fixed integration tests * Update integration tests * cs
This commit is contained in:
parent
8c2ffbfd3f
commit
61a019ad67
@ -4,7 +4,7 @@
|
||||
* Copyright (C) 2013-2016 Mailgun
|
||||
*
|
||||
* This software may be modified and distributed under the terms
|
||||
* of the MIT license. See the LICENSE file for details.
|
||||
* of the MIT license. See the LICENSE file for details.
|
||||
*/
|
||||
|
||||
namespace Mailgun\Api;
|
||||
@ -95,7 +95,7 @@ class Domain extends HttpApi
|
||||
'wildcard' => $wildcard,
|
||||
];
|
||||
|
||||
$response = $this->httpPostMultipart('/v3/domains', $params);
|
||||
$response = $this->httpPost('/v3/domains', $params);
|
||||
|
||||
return $this->safeDeserialize($response, CreateResponse::class);
|
||||
}
|
||||
@ -259,7 +259,7 @@ class Domain extends HttpApi
|
||||
$params['skip_verification'] = $noVerify ? 'true' : 'false';
|
||||
}
|
||||
|
||||
$response = $this->httpPutMultipart(sprintf('/v3/domains/%s/connection', $domain), $params);
|
||||
$response = $this->httpPut(sprintf('/v3/domains/%s/connection', $domain), $params);
|
||||
|
||||
return $this->deserializer->deserialize($response, UpdateConnectionResponse::class);
|
||||
}
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Copyright (C) 2013-2016 Mailgun
|
||||
*
|
||||
* This software may be modified and distributed under the terms
|
||||
* of the MIT license. See the LICENSE file for details.
|
||||
* of the MIT license. See the LICENSE file for details.
|
||||
*/
|
||||
|
||||
namespace Mailgun\Tests\Integration;
|
||||
@ -40,7 +40,7 @@ class DomainApiTest extends TestCase
|
||||
{
|
||||
$mg = $this->getMailgunClient();
|
||||
|
||||
$domainList = $mg->getDomainApi()->index();
|
||||
$domainList = $mg->domains()->index();
|
||||
$found = false;
|
||||
foreach ($domainList->getDomains() as $domain) {
|
||||
if ($domain->getName() === $this->testDomain) {
|
||||
@ -60,7 +60,7 @@ class DomainApiTest extends TestCase
|
||||
{
|
||||
$mg = $this->getMailgunClient();
|
||||
|
||||
$domain = $mg->getDomainApi()->show($this->testDomain);
|
||||
$domain = $mg->domains()->show($this->testDomain);
|
||||
$this->assertNotNull($domain);
|
||||
$this->assertNotNull($domain->getDomain());
|
||||
$this->assertNotNull($domain->getInboundDNSRecords());
|
||||
@ -75,7 +75,7 @@ class DomainApiTest extends TestCase
|
||||
{
|
||||
$mg = $this->getMailgunClient();
|
||||
|
||||
$ret = $mg->getDomainApi()->delete('example.notareal.tld');
|
||||
$ret = $mg->domains()->delete('example.notareal.tld');
|
||||
$this->assertNotNull($ret);
|
||||
$this->assertInstanceOf(DeleteResponse::class, $ret);
|
||||
$this->assertEquals('Domain not found', $ret->getMessage());
|
||||
@ -89,7 +89,7 @@ class DomainApiTest extends TestCase
|
||||
{
|
||||
$mg = $this->getMailgunClient();
|
||||
|
||||
$domain = $mg->getDomainApi()->create(
|
||||
$domain = $mg->domains()->create(
|
||||
'example.notareal.tld', // domain name
|
||||
'exampleOrgSmtpPassword12', // smtp password
|
||||
'tag', // default spam action
|
||||
@ -109,7 +109,7 @@ class DomainApiTest extends TestCase
|
||||
{
|
||||
$mg = $this->getMailgunClient();
|
||||
|
||||
$domain = $mg->getDomainApi()->create(
|
||||
$domain = $mg->domains()->create(
|
||||
'example.notareal.tld', // domain name
|
||||
'exampleOrgSmtpPassword12', // smtp password
|
||||
'tag', // default spam action
|
||||
@ -127,7 +127,7 @@ class DomainApiTest extends TestCase
|
||||
{
|
||||
$mg = $this->getMailgunClient();
|
||||
|
||||
$ret = $mg->getDomainApi()->delete('example.notareal.tld');
|
||||
$ret = $mg->domains()->delete('example.notareal.tld');
|
||||
$this->assertNotNull($ret);
|
||||
$this->assertInstanceOf(DeleteResponse::class, $ret);
|
||||
$this->assertEquals('Domain has been deleted', $ret->getMessage());
|
||||
@ -141,7 +141,7 @@ class DomainApiTest extends TestCase
|
||||
{
|
||||
$mg = $this->getMailgunClient();
|
||||
|
||||
$ret = $mg->getDomainApi()->createCredential(
|
||||
$ret = $mg->domains()->createCredential(
|
||||
$this->testDomain,
|
||||
'user-test@'.$this->testDomain,
|
||||
'Password.01!'
|
||||
@ -155,13 +155,13 @@ class DomainApiTest extends TestCase
|
||||
* Performs `POST /v3/domains/<domain>/credentials` to attempt to add an invalid
|
||||
* credential pair.
|
||||
*
|
||||
* @expectedException InvalidArgumentException
|
||||
* @expectedException \Mailgun\Exception\InvalidArgumentException
|
||||
*/
|
||||
public function testCreateCredentialBadPasswordLong()
|
||||
{
|
||||
$mg = $this->getMailgunClient();
|
||||
|
||||
$ret = $mg->getDomainApi()->createCredential(
|
||||
$ret = $mg->domains()->createCredential(
|
||||
$this->testDomain,
|
||||
'user-test',
|
||||
'ExtremelyLongPasswordThatCertainlyWillNotBeAccepted'
|
||||
@ -174,13 +174,13 @@ class DomainApiTest extends TestCase
|
||||
* Performs `POST /v3/domains/<domain>/credentials` to attempt to add an invalid
|
||||
* credential pair.
|
||||
*
|
||||
* @expectedException InvalidArgumentException
|
||||
* @expectedException \Mailgun\Exception\InvalidArgumentException
|
||||
*/
|
||||
public function testCreateCredentialBadPasswordShort()
|
||||
{
|
||||
$mg = $this->getMailgunClient();
|
||||
|
||||
$ret = $mg->getDomainApi()->createCredential(
|
||||
$ret = $mg->domains()->createCredential(
|
||||
$this->testDomain,
|
||||
'user-test',
|
||||
'no'
|
||||
@ -198,7 +198,7 @@ class DomainApiTest extends TestCase
|
||||
|
||||
$found = false;
|
||||
|
||||
$ret = $mg->getDomainApi()->credentials($this->testDomain);
|
||||
$ret = $mg->domains()->credentials($this->testDomain);
|
||||
$this->assertNotNull($ret);
|
||||
$this->assertInstanceOf(CredentialResponse::class, $ret);
|
||||
$this->assertContainsOnlyInstancesOf(CredentialResponseItem::class, $ret->getCredentials());
|
||||
@ -219,7 +219,7 @@ class DomainApiTest extends TestCase
|
||||
{
|
||||
$mg = $this->getMailgunClient();
|
||||
|
||||
$ret = $mg->getDomainApi()->credentials('mailgun.org');
|
||||
$ret = $mg->domains()->credentials('mailgun.org');
|
||||
$this->assertNotNull($ret);
|
||||
$this->assertInstanceOf(ErrorResponse::class, $ret);
|
||||
$this->assertEquals('Domain not found: mailgun.org', $ret->getMessage());
|
||||
@ -235,7 +235,7 @@ class DomainApiTest extends TestCase
|
||||
|
||||
$mg = $this->getMailgunClient();
|
||||
|
||||
$ret = $mg->getDomainApi()->updateCredential(
|
||||
$ret = $mg->domains()->updateCredential(
|
||||
$this->testDomain,
|
||||
$login,
|
||||
'Password..02!'
|
||||
@ -248,7 +248,7 @@ class DomainApiTest extends TestCase
|
||||
/**
|
||||
* Performs `PUT /v3/domains/<domain>/credentials/<login>` with a bad password.
|
||||
*
|
||||
* @expectedException InvalidArgumentException
|
||||
* @expectedException \Mailgun\Exception\InvalidArgumentException
|
||||
*/
|
||||
public function testUpdateCredentialBadPasswordLong()
|
||||
{
|
||||
@ -256,7 +256,7 @@ class DomainApiTest extends TestCase
|
||||
|
||||
$mg = $this->getMailgunClient();
|
||||
|
||||
$ret = $mg->getDomainApi()->updateCredential(
|
||||
$ret = $mg->domains()->updateCredential(
|
||||
$this->testDomain,
|
||||
$login,
|
||||
'ThisIsAnExtremelyLongPasswordThatSurelyWontBeAccepted'
|
||||
@ -267,7 +267,7 @@ class DomainApiTest extends TestCase
|
||||
/**
|
||||
* Performs `PUT /v3/domains/<domain>/credentials/<login>` with a bad password.
|
||||
*
|
||||
* @expectedException InvalidArgumentException
|
||||
* @expectedException \Mailgun\Exception\InvalidArgumentException
|
||||
*/
|
||||
public function testUpdateCredentialBadPasswordShort()
|
||||
{
|
||||
@ -275,7 +275,7 @@ class DomainApiTest extends TestCase
|
||||
|
||||
$mg = $this->getMailgunClient();
|
||||
|
||||
$ret = $mg->getDomainApi()->updateCredential(
|
||||
$ret = $mg->domains()->updateCredential(
|
||||
$this->testDomain,
|
||||
$login,
|
||||
'no'
|
||||
@ -293,7 +293,7 @@ class DomainApiTest extends TestCase
|
||||
|
||||
$mg = $this->getMailgunClient();
|
||||
|
||||
$ret = $mg->getDomainApi()->deleteCredential(
|
||||
$ret = $mg->domains()->deleteCredential(
|
||||
$this->testDomain,
|
||||
$login
|
||||
);
|
||||
@ -313,7 +313,7 @@ class DomainApiTest extends TestCase
|
||||
|
||||
$mg = $this->getMailgunClient();
|
||||
|
||||
$ret = $mg->getDomainApi()->deleteCredential(
|
||||
$ret = $mg->domains()->deleteCredential(
|
||||
$this->testDomain,
|
||||
$login
|
||||
);
|
||||
@ -329,7 +329,7 @@ class DomainApiTest extends TestCase
|
||||
{
|
||||
$mg = $this->getMailgunClient();
|
||||
|
||||
$ret = $mg->getDomainApi()->connection($this->testDomain);
|
||||
$ret = $mg->domains()->connection($this->testDomain);
|
||||
$this->assertNotNull($ret);
|
||||
$this->assertInstanceOf(ConnectionResponse::class, $ret);
|
||||
$this->assertTrue(is_bool($ret->getSkipVerification()));
|
||||
@ -343,7 +343,7 @@ class DomainApiTest extends TestCase
|
||||
{
|
||||
$mg = $this->getMailgunClient();
|
||||
|
||||
$ret = $mg->getDomainApi()->updateConnection(
|
||||
$ret = $mg->domains()->updateConnection(
|
||||
$this->testDomain,
|
||||
true,
|
||||
false
|
||||
|
Loading…
Reference in New Issue
Block a user