Skip to content

Commit

Permalink
test tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
gggeek committed Sep 7, 2024
1 parent cc91a90 commit 573db6e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 9 deletions.
20 changes: 20 additions & 0 deletions tests/07ClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,26 @@ public function testCurlKAErr()
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);
Expand Down
9 changes: 0 additions & 9 deletions tests/09HTTPTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -530,15 +530,6 @@ public function testDigestAuth($method)
$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
Expand Down

0 comments on commit 573db6e

Please sign in to comment.