diff --git a/src/Curl/Curl.php b/src/Curl/Curl.php index baa2d61..05ed0f3 100644 --- a/src/Curl/Curl.php +++ b/src/Curl/Curl.php @@ -4,6 +4,10 @@ declare(strict_types=1); namespace Curl; +/** + * @property-read string $curlErrorCodeConstant + * @property-read array $curlErrorCodeConstants + */ class Curl extends BaseCurl { public const VERSION = '13.0.2'; @@ -92,9 +96,6 @@ class Curl extends BaseCurl 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '{', '|', '}', '~', ]; - public $curlErrorCodeConstant; - public $curlErrorCodeConstants; - private static $deferredProperties = [ 'curlErrorCodeConstant', 'curlErrorCodeConstants', diff --git a/tests/PHPCurlClass/PHPCurlClassTest.php b/tests/PHPCurlClass/PHPCurlClassTest.php index 4fb8508..a2c6931 100644 --- a/tests/PHPCurlClass/PHPCurlClassTest.php +++ b/tests/PHPCurlClass/PHPCurlClassTest.php @@ -1403,6 +1403,15 @@ class PHPCurlClassTest extends \PHPUnit\Framework\TestCase $this->assertEquals('HTTP/1.1 401 Unauthorized', $test->curl->errorMessage); } + public function testCurlErrorMessageIncludesErrorCodeConstant() + { + $curl = new Curl(); + $curl->get('unsupported://127.0.0.1/'); + $this->assertEquals(CURLE_UNSUPPORTED_PROTOCOL, $curl->curlErrorCode); + $this->assertEquals('CURLE_UNSUPPORTED_PROTOCOL', $curl->curlErrorCodeConstant); + $this->assertStringContainsString('(CURLE_UNSUPPORTED_PROTOCOL)', $curl->curlErrorMessage); + } + public function testRequestHeaderCaseSensitivity() { $content_type = 'application/json';