mirror of
https://github.com/retailcrm/mailgun-php.git
synced 2024-11-25 14:26:04 +03:00
Make sure we dont use any risky tests
This commit is contained in:
parent
0f54332d0e
commit
3fbd33f640
@ -26,7 +26,7 @@ abstract class TestCase extends \PHPUnit\Framework\TestCase
|
|||||||
|
|
||||||
private $requestUri;
|
private $requestUri;
|
||||||
|
|
||||||
private $requestHeaders;
|
private $requestHeaders = [];
|
||||||
|
|
||||||
private $requestBody;
|
private $requestBody;
|
||||||
|
|
||||||
@ -89,14 +89,23 @@ abstract class TestCase extends \PHPUnit\Framework\TestCase
|
|||||||
$requestClient = $this->getMockBuilder('Mailgun\HttpClient\RequestBuilder')
|
$requestClient = $this->getMockBuilder('Mailgun\HttpClient\RequestBuilder')
|
||||||
->setMethods(['create'])
|
->setMethods(['create'])
|
||||||
->getMock();
|
->getMock();
|
||||||
$requestClient->method('create')
|
|
||||||
->with(
|
if (null !== $this->requestMethod
|
||||||
$this->callback([$this, 'validateRequestMethod']),
|
|| null !== $this->requestUri
|
||||||
$this->callback([$this, 'validateRequestUri']),
|
|| !empty($this->requestHeaders)
|
||||||
$this->callback([$this, 'validateRequestHeaders']),
|
|| !empty($this->requestBody)
|
||||||
$this->callback([$this, 'validateRequestBody'])
|
) {
|
||||||
)
|
$requestClient
|
||||||
->willReturn(new Request('GET', '/'));
|
->expects($this->once())
|
||||||
|
->method('create')
|
||||||
|
->with(
|
||||||
|
$this->callback([$this, 'validateRequestMethod']),
|
||||||
|
$this->callback([$this, 'validateRequestUri']),
|
||||||
|
$this->callback([$this, 'validateRequestHeaders']),
|
||||||
|
$this->callback([$this, 'validateRequestBody'])
|
||||||
|
)
|
||||||
|
->willReturn(new Request('GET', '/'));
|
||||||
|
}
|
||||||
|
|
||||||
$hydrator = new ModelHydrator();
|
$hydrator = new ModelHydrator();
|
||||||
if (null === $this->httpResponse) {
|
if (null === $this->httpResponse) {
|
||||||
@ -198,18 +207,13 @@ abstract class TestCase extends \PHPUnit\Framework\TestCase
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set request http method.
|
* Set request http method.
|
||||||
*
|
|
||||||
* @param string $httpMethod
|
|
||||||
*/
|
*/
|
||||||
public function setRequestMethod($httpMethod)
|
public function setRequestMethod(string $httpMethod)
|
||||||
{
|
{
|
||||||
$this->requestMethod = $httpMethod;
|
$this->requestMethod = $httpMethod;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function setRequestUri(string $requestUri)
|
||||||
* @param string $requestUri
|
|
||||||
*/
|
|
||||||
public function setRequestUri($requestUri)
|
|
||||||
{
|
{
|
||||||
$this->requestUri = $requestUri;
|
$this->requestUri = $requestUri;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user