From 573db6e6ba37208730f449615524cf6f6c08cfc8 Mon Sep 17 00:00:00 2001 From: gggeek Date: Sat, 7 Sep 2024 13:36:52 +0000 Subject: [PATCH] test tweak --- tests/07ClientTest.php | 20 ++++++++++++++++++++ tests/09HTTPTest.php | 9 --------- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/tests/07ClientTest.php b/tests/07ClientTest.php index c8a7bd09..4288c31d 100644 --- a/tests/07ClientTest.php +++ b/tests/07ClientTest.php @@ -98,6 +98,26 @@ class ClientTest extends PhpXmlRpc_ServerAwareTestCase is_object($ro) && $this->assertEquals('hello', $ro->scalarVal()); } + public function testCustomHeaders() + { + $opts = array(\PhpXmlRpc\Client::USE_CURL_NEVER); + if (function_exists('curl_init')) + { + $opts[] = \PhpXmlRpc\Client::USE_CURL_ALWAYS; + } + + $this->client->setOption(\PhpXmlRpc\Client::OPT_EXTRA_HEADERS, array('X-PXR-Test: yes')); + $r = new \PhpXmlRpc\Request('tests.getallheaders'); + + foreach ($opts as $opt) { + $this->client->setOption(\PhpXmlRpc\Client::OPT_USE_CURL, $opt); + $r = $this->client->send($r); + $this->assertEquals(0, $r->faultCode()); + $ro = $r->value(); + $this->assertArrayHasKey('X-Pxr-Test', $ro->scalarVal(), "Testing with curl mode: $opt"); + } + } + public function testgetUrl() { $m = $this->client->getUrl(PHP_URL_SCHEME); diff --git a/tests/09HTTPTest.php b/tests/09HTTPTest.php index 19dd85c7..536e30f4 100644 --- a/tests/09HTTPTest.php +++ b/tests/09HTTPTest.php @@ -530,15 +530,6 @@ class HTTPTest extends ServerTest $this->$method(); } - public function testCustomHeaders() - { - $this->client->setOption(\PhpXmlRpc\Client::OPT_EXTRA_HEADERS, array('X-PXR-Test: yes')); - - $r = new \PhpXmlRpc\Request('tests.getallheaders'); - $v = $this->send($r); - $this->assertArrayHasKey('X-Pxr-Test', $v); - } - /** * @param \PhpXmlRpc\Response $r * @return void -- 2.47.0