add subscriber tests
This commit is contained in:
@ -20,6 +20,7 @@ use D3\KlicktippPhpClient\tests\TestCase;
|
||||
use GuzzleHttp\Client;
|
||||
use GuzzleHttp\Handler\MockHandler;
|
||||
use GuzzleHttp\HandlerStack;
|
||||
use GuzzleHttp\Middleware;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
/**
|
||||
@ -27,11 +28,16 @@ use Psr\Http\Message\ResponseInterface;
|
||||
*/
|
||||
class IntegrationTestCase extends TestCase
|
||||
{
|
||||
protected array $historyContainer = [];
|
||||
|
||||
public function getConnectionMock(ResponseInterface $response): Connection
|
||||
{
|
||||
$mock = new MockHandler([$response]);
|
||||
|
||||
$history = Middleware::history($this->historyContainer);
|
||||
|
||||
$handlerStack = HandlerStack::create($mock);
|
||||
$handlerStack->push($history);
|
||||
$client = new Client(['handler' => $handlerStack]);
|
||||
|
||||
$connection = new Connection('userName', 'password');
|
||||
@ -39,4 +45,9 @@ class IntegrationTestCase extends TestCase
|
||||
|
||||
return $connection;
|
||||
}
|
||||
|
||||
protected function getHistoryContainer(): array
|
||||
{
|
||||
return $this->historyContainer;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user