mailgun-php/tests/Api/StatsTest.php
Tobias Nyholm 738e6e32e2 POC - Better api (#192)
* Added base for the new API

* code style

* Added response classes

* Added support for serializer

* The abstract API should not know of Mailgun

* Minor

* minor

* Using a client configrator

* code style

* Put HTTPClient in the configurator

* Do not use the api() function

* Use stable version of Assert

* style

* Fixed tests

* make the httpClient private

* Renamed ResponseSerializer to ResponseDeserializer

* Disabled tests that are testing error messages with Assert

* style fixes

* Refactoring fix
2016-10-24 12:01:32 -05:00

65 lines
1.3 KiB
PHP

<?php
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())
->method('get')
->with('/v3/domain/stats/total', $data)
->willReturn(new Response());
$api->total('domain', $data);
}
/**
* expectedException \Mailgun\Exception\InvalidArgumentException.
*/
//public function testTotalInvalidArgument()
//{
// $api = $this->getApiMock();
// $api->total('');
//}
public function testAll()
{
$data = [
'foo' => 'bar',
];
$api = $this->getApiMock();
$api->expects($this->once())
->method('get')
->with('/v3/domain/stats', $data)
->willReturn(new Response());
$api->all('domain', $data);
}
/*
* expectedException \Mailgun\Exception\InvalidArgumentException
*/
//public function testAllInvalidArgument()
//{
// $api = $this->getApiMock();
// $api->all('');
//}
}