2021-05-13 21:08:55 +03:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
2021-05-14 18:57:35 +03:00
|
|
|
* PHP 7.2
|
2021-05-13 21:08:55 +03:00
|
|
|
*
|
|
|
|
* @category MockInterface
|
|
|
|
* @package Pock
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace Pock;
|
|
|
|
|
|
|
|
use Pock\Matchers\RequestMatcherInterface;
|
|
|
|
use Psr\Http\Message\ResponseInterface;
|
|
|
|
use Throwable;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Interface MockInterface
|
|
|
|
*
|
|
|
|
* @category MockInterface
|
|
|
|
* @package Pock
|
|
|
|
*/
|
|
|
|
interface MockInterface
|
|
|
|
{
|
|
|
|
/**
|
2021-05-14 18:52:00 +03:00
|
|
|
* Registers a hit to the mock.
|
2021-05-13 21:08:55 +03:00
|
|
|
*
|
|
|
|
* @return \Pock\MockInterface
|
|
|
|
*/
|
2021-05-14 18:52:00 +03:00
|
|
|
public function registerHit(): MockInterface;
|
2021-05-13 21:08:55 +03:00
|
|
|
|
|
|
|
/**
|
2021-05-14 18:52:00 +03:00
|
|
|
* Returns true if mock is still can be used.
|
2021-05-13 21:08:55 +03:00
|
|
|
*
|
|
|
|
* @return bool
|
|
|
|
*/
|
2021-05-14 18:52:00 +03:00
|
|
|
public function available(): bool;
|
2021-05-13 21:08:55 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns matcher for the request.
|
|
|
|
*
|
|
|
|
* @return \Pock\Matchers\RequestMatcherInterface
|
|
|
|
*/
|
|
|
|
public function getMatcher(): RequestMatcherInterface;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns response which should be used as mock data.
|
|
|
|
*
|
|
|
|
* @return \Psr\Http\Message\ResponseInterface|null
|
|
|
|
*/
|
|
|
|
public function getResponse(): ?ResponseInterface;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the throwable which will be thrown as mock data.
|
|
|
|
*
|
|
|
|
* @return \Throwable|null
|
|
|
|
*/
|
|
|
|
public function getThrowable(): ?Throwable;
|
|
|
|
}
|