mirror of
https://github.com/retailcrm/mailgun-php.git
synced 2025-02-06 08:19:25 +03:00
Added bounce test
This commit is contained in:
parent
d6e48c6bc2
commit
55547572aa
90
tests/Api/Suppression/BounceTest.php
Normal file
90
tests/Api/Suppression/BounceTest.php
Normal file
@ -0,0 +1,90 @@
|
||||
<?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\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
|
||||
{
|
||||
public function testIndex()
|
||||
{
|
||||
$this->setRequestMethod('GET');
|
||||
$this->setRequestUri('/v3/example.com/bounces?limit=100');
|
||||
$this->setHydrateClass(IndexResponse::class);
|
||||
|
||||
$api = $this->getApiInstance();
|
||||
$api->index('example.com');
|
||||
}
|
||||
|
||||
public function testShow()
|
||||
{
|
||||
$this->setRequestMethod('GET');
|
||||
$this->setRequestUri('/v3/example.com/bounces/foo@bar.com');
|
||||
$this->setHydrateClass(ShowResponse::class);
|
||||
|
||||
$api = $this->getApiInstance();
|
||||
$api->show('example.com', 'foo@bar.com');
|
||||
}
|
||||
|
||||
public function testCreate()
|
||||
{
|
||||
$this->setRequestMethod('POST');
|
||||
$this->setRequestUri('/v3/example.com/bounces');
|
||||
$this->setHydrateClass(CreateResponse::class);
|
||||
$this->setRequestBody([
|
||||
'address' => 'foo@bar.com',
|
||||
'foo'=>'xxx',
|
||||
]);
|
||||
|
||||
$api = $this->getApiInstance();
|
||||
$api->create('example.com', 'foo@bar.com', ['foo'=>'xxx']);
|
||||
}
|
||||
|
||||
|
||||
public function testDelete()
|
||||
{
|
||||
$this->setRequestMethod('DELETE');
|
||||
$this->setRequestUri('/v3/example.com/bounces/foo@bar.com');
|
||||
$this->setHydrateClass(DeleteResponse::class);
|
||||
|
||||
$api = $this->getApiInstance();
|
||||
$api->show('example.com', 'foo@bar.com');
|
||||
}
|
||||
|
||||
public function testDeleteAll()
|
||||
{
|
||||
$this->setRequestMethod('DELETE');
|
||||
$this->setRequestUri('/v3/example.com/bounces');
|
||||
$this->setHydrateClass(DeleteResponse::class);
|
||||
|
||||
$api = $this->getApiInstance();
|
||||
$api->show('example.com');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function getApiClass()
|
||||
{
|
||||
return Bounce::class;
|
||||
}
|
||||
}
|
46
tests/Api/SuppressionTest.php
Normal file
46
tests/Api/SuppressionTest.php
Normal file
@ -0,0 +1,46 @@
|
||||
<?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\Api;
|
||||
|
||||
use Mailgun\Api\Suppression;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author Tobias Nyholm <tobias.nyholm@gmail.com>
|
||||
*/
|
||||
class SuppressionTest extends TestCase
|
||||
{
|
||||
public function testBounces()
|
||||
{
|
||||
$api = $this->getApiInstance();
|
||||
$this->assertInstanceOf(Suppression\Bounce::class, $api->bounces());
|
||||
}
|
||||
|
||||
public function testComplaints()
|
||||
{
|
||||
$api = $this->getApiInstance();
|
||||
$this->assertInstanceOf(Suppression\Complaint::class, $api->complaints());
|
||||
}
|
||||
|
||||
public function testUnsubscribes()
|
||||
{
|
||||
$api = $this->getApiInstance();
|
||||
$this->assertInstanceOf(Suppression\Unsubscribe::class, $api->unsubscribes());
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function getApiClass()
|
||||
{
|
||||
return Suppression::class;
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user