2016-10-24 20:01:32 +03:00
|
|
|
<?php
|
|
|
|
|
2016-11-24 01:02:12 +03:00
|
|
|
/*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
2016-10-24 20:01:32 +03:00
|
|
|
namespace Mailgun\Tests\Api;
|
|
|
|
|
|
|
|
use GuzzleHttp\Psr7\Response;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @author Tobias Nyholm <tobias.nyholm@gmail.com>
|
|
|
|
*/
|
|
|
|
class StatsTest extends TestCase
|
|
|
|
{
|
|
|
|
protected function getApiClass()
|
|
|
|
{
|
|
|
|
return 'Mailgun\Api\Stats';
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testTotal()
|
|
|
|
{
|
|
|
|
$data = [
|
|
|
|
'foo' => 'bar',
|
|
|
|
];
|
|
|
|
|
|
|
|
$api = $this->getApiMock();
|
|
|
|
$api->expects($this->once())
|
2016-11-11 23:53:26 +03:00
|
|
|
->method('httpGet')
|
2016-10-24 20:01:32 +03:00
|
|
|
->with('/v3/domain/stats/total', $data)
|
|
|
|
->willReturn(new Response());
|
|
|
|
|
|
|
|
$api->total('domain', $data);
|
|
|
|
}
|
|
|
|
|
2016-11-24 01:01:26 +03:00
|
|
|
/**
|
|
|
|
* @expectedException \Mailgun\Exception\InvalidArgumentException
|
|
|
|
*/
|
|
|
|
public function testTotalInvalidArgument()
|
|
|
|
{
|
|
|
|
$api = $this->getApiMock();
|
|
|
|
$api->total('');
|
|
|
|
}
|
2016-10-24 20:01:32 +03:00
|
|
|
|
|
|
|
public function testAll()
|
|
|
|
{
|
|
|
|
$data = [
|
|
|
|
'foo' => 'bar',
|
|
|
|
];
|
|
|
|
|
|
|
|
$api = $this->getApiMock();
|
|
|
|
$api->expects($this->once())
|
2016-11-11 23:53:26 +03:00
|
|
|
->method('httpGet')
|
2016-10-24 20:01:32 +03:00
|
|
|
->with('/v3/domain/stats', $data)
|
|
|
|
->willReturn(new Response());
|
|
|
|
|
|
|
|
$api->all('domain', $data);
|
|
|
|
}
|
|
|
|
|
2016-11-24 01:01:26 +03:00
|
|
|
/**
|
|
|
|
* @expectedException \Mailgun\Exception\InvalidArgumentException
|
|
|
|
*/
|
|
|
|
public function testAllInvalidArgument()
|
|
|
|
{
|
|
|
|
$api = $this->getApiMock();
|
|
|
|
|
|
|
|
$api->all('');
|
|
|
|
}
|
2016-10-24 20:01:32 +03:00
|
|
|
}
|