mirror of
https://github.com/retailcrm/mailgun-php.git
synced 2025-02-11 10:49:23 +03:00
738e6e32e2
* 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
36 lines
1.1 KiB
PHP
36 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace Mailgun\Tests\Api;
|
|
|
|
/**
|
|
* @author Tobias Nyholm <tobias.nyholm@gmail.com>
|
|
* @author Contributors of https://github.com/KnpLabs/php-github-api
|
|
*/
|
|
abstract class TestCase extends \PHPUnit_Framework_TestCase
|
|
{
|
|
abstract protected function getApiClass();
|
|
|
|
protected function getApiMock()
|
|
{
|
|
$httpClient = $this->getMockBuilder('Http\Client\HttpClient')
|
|
->setMethods(['sendRequest'])
|
|
->getMock();
|
|
$httpClient
|
|
->expects($this->any())
|
|
->method('sendRequest');
|
|
|
|
$requestClient = $this->getMockBuilder('Http\Message\MessageFactory')
|
|
->setMethods(['createRequest', 'createResponse'])
|
|
->getMock();
|
|
|
|
$serializer = $this->getMockBuilder('Mailgun\Serializer\ResponseDeserializer')
|
|
->setMethods(['deserialize'])
|
|
->getMock();
|
|
|
|
return $this->getMockBuilder($this->getApiClass())
|
|
->setMethods(['get', 'post', 'postRaw', 'delete', 'put'])
|
|
->setConstructorArgs([$httpClient, $requestClient, $serializer])
|
|
->getMock();
|
|
}
|
|
}
|