mirror of
https://github.com/retailcrm/mailgun-php.git
synced 2024-11-22 20:46:03 +03:00
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();
|
||
|
}
|
||
|
}
|