for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php declare(strict_types = 1);
namespace SlevomatCsobGateway\Api\Driver;
use PHPUnit\Framework\TestCase;
use SlevomatCsobGateway\Api\HttpMethod;
use SlevomatCsobGateway\Api\ResponseCode;
class CurlDriverTest extends TestCase
{
/**
* @runInSeparateProcess
*/
public function testRequest(): void
include __DIR__ . '/CurlMock.php';
$curlDriver = new CurlDriver();
$response = $curlDriver->request(
HttpMethod::get(HttpMethod::POST),
'foo/url',
null,
[
'Content-Type' => 'application/json',
]
);
self::assertSame(ResponseCode::S200_OK, $response->getResponseCode()->getValue());
self::assertEquals([
'text' => 'foo text',
], $response->getData());
'abc' => 'def',
], $response->getHeaders());
}
public function testCurlDriverException(): void
include __DIR__ . '/Curl_exec_false_Mock.php';
try {
$curlDriver->request(
} catch (CurlDriverException $e) {
self::assertSame(11, $e->getCode());
self::assertSame('foo getinfo', $e->getInfo());