mirror of
https://github.com/retailcrm/mailgun-php.git
synced 2024-11-27 23:36:06 +03:00
74 lines
1.6 KiB
PHP
74 lines
1.6 KiB
PHP
|
<?php
|
||
|
|
||
|
/*
|
||
|
* Copyright (C) 2013 Mailgun
|
||
|
*
|
||
|
* This software may be modified and distributed under the terms
|
||
|
* of the MIT license. See the LICENSE file for details.
|
||
|
*/
|
||
|
|
||
|
namespace Mailgun\Tests\Model\Domain;
|
||
|
|
||
|
use Mailgun\Model\Domain\Domain;
|
||
|
use Mailgun\Model\Domain\ShowResponse;
|
||
|
use Mailgun\Tests\Model\BaseModelTest;
|
||
|
|
||
|
class ShowResponseTest extends BaseModelTest
|
||
|
{
|
||
|
public function testCreate()
|
||
|
{
|
||
|
$json =
|
||
|
<<<'JSON'
|
||
|
{
|
||
|
"domain": {
|
||
|
"created_at": "Wed, 10 Jul 2013 19:26:52 GMT",
|
||
|
"smtp_login": "postmaster@domain.com",
|
||
|
"name": "domain.com",
|
||
|
"smtp_password": "4rtqo4p6rrx9",
|
||
|
"wildcard": false,
|
||
|
"spam_action": "tag",
|
||
|
"state": "active"
|
||
|
},
|
||
|
"receiving_dns_records": [
|
||
|
{
|
||
|
"priority": "10",
|
||
|
"record_type": "MX",
|
||
|
"valid": "valid",
|
||
|
"value": "mxa.mailgun.org"
|
||
|
},
|
||
|
{
|
||
|
"priority": "10",
|
||
|
"record_type": "MX",
|
||
|
"valid": "valid",
|
||
|
"value": "mxb.mailgun.org"
|
||
|
}
|
||
|
],
|
||
|
"sending_dns_records": [
|
||
|
{
|
||
|
"record_type": "TXT",
|
||
|
"valid": "valid",
|
||
|
"name": "domain.com",
|
||
|
"value": "v=spf1 include:mailgun.org ~all"
|
||
|
},
|
||
|
{
|
||
|
"record_type": "TXT",
|
||
|
"valid": "valid",
|
||
|
"name": "domain.com",
|
||
|
"value": "k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUA...."
|
||
|
},
|
||
|
{
|
||
|
"record_type": "CNAME",
|
||
|
"valid": "valid",
|
||
|
"name": "email.domain.com",
|
||
|
"value": "mailgun.org"
|
||
|
}
|
||
|
]
|
||
|
}
|
||
|
JSON;
|
||
|
$model = ShowResponse::create(json_decode($json, true));
|
||
|
$this->assertCount(2, $model->getInboundDNSRecords());
|
||
|
$this->assertCount(3, $model->getOutboundDNSRecords());
|
||
|
$this->assertInstanceOf(Domain::class, $model->getDomain());
|
||
|
}
|
||
|
}
|