mirror of
https://github.com/retailcrm/mailgun-php.git
synced 2024-11-29 08:26:06 +03:00
Pool id tests (#793)
* Add the `pool_id` parameter to Domain::create() * Formatting * Added tests * Added missing comma Co-authored-by: Roy Hill-Percival <github@royhp.com>
This commit is contained in:
parent
d987c3e5e2
commit
6853b03247
@ -84,10 +84,11 @@ class Domain extends HttpApi
|
||||
* @param bool $wildcard domain will accept email for subdomains
|
||||
* @param bool $forceDkimAuthority force DKIM authority
|
||||
* @param string[] $ips an array of ips to be assigned to the domain
|
||||
* @param ?string $pool_id pool id to assign to the domain
|
||||
*
|
||||
* @return CreateResponse|array|ResponseInterface
|
||||
*/
|
||||
public function create(string $domain, string $smtpPass = null, string $spamAction = null, bool $wildcard = null, bool $forceDkimAuthority = null, ?array $ips = null)
|
||||
public function create(string $domain, string $smtpPass = null, string $spamAction = null, bool $wildcard = null, bool $forceDkimAuthority = null, ?array $ips = null, ?string $pool_id = null)
|
||||
{
|
||||
Assert::stringNotEmpty($domain);
|
||||
|
||||
@ -125,6 +126,12 @@ class Domain extends HttpApi
|
||||
$params['ips'] = join(',', $ips);
|
||||
}
|
||||
|
||||
if (null !== $pool_id) {
|
||||
Assert::stringNotEmpty($pool_id);
|
||||
|
||||
$params['pool_id'] = $pool_id;
|
||||
}
|
||||
|
||||
$response = $this->httpPost('/v3/domains', $params);
|
||||
|
||||
return $this->hydrateResponse($response, CreateResponse::class);
|
||||
|
@ -103,6 +103,21 @@ JSON
|
||||
$api->create('example.com', 'foo');
|
||||
}
|
||||
|
||||
public function testCreateWithPoolId()
|
||||
{
|
||||
$this->setRequestMethod('POST');
|
||||
$this->setRequestUri('/v3/domains');
|
||||
$this->setRequestBody([
|
||||
'name' => 'example.com',
|
||||
'smtp_password' => 'foo',
|
||||
'pool_id' => '123',
|
||||
]);
|
||||
$this->setHydrateClass(CreateResponse::class);
|
||||
|
||||
$api = $this->getApiInstance();
|
||||
$api->create('example.com', 'foo', null, null, null, null, '123');
|
||||
}
|
||||
|
||||
public function testCreateWithPasswordSpamAction()
|
||||
{
|
||||
$this->setRequestMethod('POST');
|
||||
|
Loading…
Reference in New Issue
Block a user