Add phpunit tests for header key/value exceptions
This commit is contained in:
@@ -1043,6 +1043,46 @@ final class CoreLibsUrlRequestsCurlTest extends TestCase
|
|||||||
$curl->request('wrong', 'http://foo.bar.com');
|
$curl->request('wrong', 'http://foo.bar.com');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exception:InvalidHeaderKey
|
||||||
|
*
|
||||||
|
* @covers ::request
|
||||||
|
* @testdox UrlRequests\Curl Exception:InvalidHeaderKey
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function testExceptionInvalidHeaderKey(): void
|
||||||
|
{
|
||||||
|
$curl = new \CoreLibs\UrlRequests\Curl();
|
||||||
|
$this->expectException(\RuntimeException::class);
|
||||||
|
$this->expectExceptionMessageMatches("/InvalidHeaderKey/");
|
||||||
|
$curl->request('get', $this->url_basic, [
|
||||||
|
"headers" => [
|
||||||
|
"(invalid-key)" => "key"
|
||||||
|
]
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exception:InvalidHeaderValue
|
||||||
|
*
|
||||||
|
* @covers ::request
|
||||||
|
* @testdox UrlRequests\Curl Exception:InvalidHeaderValue
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function testExceptionInvalidHeaderValue(): void
|
||||||
|
{
|
||||||
|
$curl = new \CoreLibs\UrlRequests\Curl();
|
||||||
|
$this->expectException(\RuntimeException::class);
|
||||||
|
$this->expectExceptionMessageMatches("/InvalidHeaderValue/");
|
||||||
|
$curl->request('get', $this->url_basic, [
|
||||||
|
"headers" => [
|
||||||
|
"invalid-value" => "\x19\x10"
|
||||||
|
]
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO: Exception:CurlInitError
|
* TODO: Exception:CurlInitError
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user